So here is my script(in ServerScriptService):
local rs = game:GetService("ReplicatedStorage") local events = rs:WaitForChild("Events") local spawnEvent = events:WaitForChild("Spawn") local rs = game:GetService("ReplicatedStorage") local buses = workspace:WaitForChild("ShopBuses") local rtaBus = buses:WaitForChild("RTABus") local busSpawn = workspace:WaitForChild("BusSpawn") spawnEvent.OnServerEvent:connect(function(plr,msg) local clone = rtaBus:Clone() clone:SetPrimaryPartCFrame(busSpawn.CFrame) if clone then print("Sucess!") end end)
How it is suppose to work:
1)Player presses spawn button
2)Event(spawnEvent) gets fired
3)Bus gets spawned --Doesn't do it
The script does print "Success" but the bus doesn't spawn.
The script is running of a event in Replicated Storage(it works)
So what's wrong?
Need to parent clone to workspace
local rs = game:GetService("ReplicatedStorage") local events = rs:WaitForChild("Events") local spawnEvent = events:WaitForChild("Spawn") local rs = game:GetService("ReplicatedStorage") local buses = workspace:WaitForChild("ShopBuses") local rtaBus = buses:WaitForChild("RTABus") local busSpawn = workspace:WaitForChild("BusSpawn") spawnEvent.OnServerEvent:Connect(function(plr,msg) local clone = rtaBus:Clone() clone.Parent = workspace clone:SetPrimaryPartCFrame(busSpawn.CFrame) if clone then print("Sucess!") end end)