#who i fix this

1 messages · Page 1 of 1 (latest)

languid prairie
#

who i can spawn a van for strorage to my workspace help me !!!

grand mica
languid prairie
#

ok

#

still dont work

grave krakenBOT
#

studio** You are now Level 1! **studio

chilly sage
languid prairie
#

who?

chilly sage
#

the code

languid prairie
#

who i see it

#

where is the van at

chilly sage
#

is ur brain ok

languid prairie
chilly sage
#

genuinely

languid prairie
#

?

#

now what?

chilly sage
#

below where u set a variable for the van

#

add an if statement to check if it finds the van

languid prairie
#

can toy sent me the statement script pls?

chilly sage
#
local enabled = false

script.Parent.MouseButton1Click:Connect(function(GetCar)
if enabled == true then return end
enabled true
local Mod game.ServerStorage:WaitForChild("MafiaVan")
if not Mod then print("Can not find van!") end
local clone = Mod:Clone() 
clone.Parent = workspace
wait(25) 
enabled = false
end)
#

hold on

languid prairie
#

this i will put in the script or create a new script

chilly sage
#

some stuff wrong

languid prairie
#

?

#

ok

chilly sage
#

there

#

just replace it in the same script

languid prairie
#

ok

#

and i have another problem in studio my guis open but in roblox in game dosent open i dont know who to fix it help pls

grand mica
#
local ServerStorage = game:GetService("ServerStorage")

local mod = ServerStorage.MafiaVan

local ENABLED = false

script.Parent.MouseClick:Connect(function()
    if ENABLED then
        return
    end
    ENABLED = true
    local clone = mod:Clone()
    clone.Parent = workspace
    task.wait(25)
    ENABLED = false
end)
#

Corrected Code

#

@languid prairie, is the MouseButton click GUI or a ClickDetector

chilly sage
chilly sage
#

Yes.

grand mica
#

It's repetitive.

chilly sage
#

its almost like i just added an if statement and did :WaitForChild

grand mica
#

You'd know it is wrong and not a good practice

chilly sage
#

i would say adding waitforchild would be good practice but ig yk best

grand mica
#

You do realize that using WaitForChild() on server gives out alot of errors.

chilly sage
#

ive not had that happen once

grand mica
grand mica
#

You only use WaitForChild() on the client, not on the server.

grave krakenBOT
#

studio** You are now Level 1! **studio

candid egret
candid egret
#

what?

grand mica
#

Your right, just checked the docs.

#

It's supposed to be MouseClick not MouseButton1Click.

candid egret
#

it will be good if we add a position also

grand mica
#

If it's client he must use it ReplicatedStorage.

candid egret
#

because normally it will spawn the car in 0,0,0

candid egret
grand mica
grand mica
#

Not client.

candid egret
#

yes

#

if he was using mouse and for client then we can make a random system by using math.random(1,100) to make it so that if the number chosen by math.random is 1 then the car spawns on this position and other positions for the rest of the positions

chilly sage
candid egret
#

what

candid egret
drowsy crow
#

this man struggles to create variables and you make him do arrays