Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why is it that this script only works on studio simulations, but not servers?

So basically i decided to make a script that will spawn about 500 parts, then crash them into the ground and explode. So when i tested it in the studio simulations it worked, but when i try to run this script on a server it does not work. Nothing pops up in Output so im so confsed on why it wont work. I have 2 parts contacting via Remote Events

Local Script inside of players backpack

local player = game.Players.LocalPlayer
name = player.Name
uis = game:GetService("UserInputService")
deb = false
uis.InputBegan:connect(function(key,proc)
	if not proc then
		if key.KeyCode == Enum.KeyCode.G and deb == false then
			game.Workspace.RainRun:FireServer()
			deb =  true
script.Sound:Play()


			local light = game:GetService("Lighting")
			light.TimeOfDay = 0
light.Brightness = 0
			local model = Instance.new("Model",game.Workspace)
			model.Name = "Storage"
			for i = 1,500 do
				local  part = game.Workspace.Get:Clone()
				part.Anchored = false
	part.Velocity = Vector3.new(10,50*10,10)
	
				part.CFrame = player.Character.Head.CFrame * CFrame.new(0,1,0)

part.Bind:FireServer(name)
part.Parent = game.Workspace.Storage
wait()
		end
local point = Instance.new("PointLight",player.Character.Torso)
point.Brightness = 25
player.Character.Humanoid.WalkSpeed = 50
local f = script.Fist:Clone()
f.Parent = player.Character["Right Arm"]
script.Parent.Parent.Fight.Disabled = false
wait(5)

wait(20) 
local ctor = game.Workspace.Storage
ctor:Destroy()

wait(15)
deb = false
		end
	end
	
end)

Thats a script inside of the payer that is fired whenever they hit the Letter G on the keyboard

**Script inside of the part **


script.Parent.Bind.OnServerEvent:connect(function(player,name)
print("got")
script.Parent.Touched:connect(function(hit)
	wait(15)



	if hit.Parent:FindFirstChild("Humanoid") then
if hit.Parent.Name ~= name then
	hit.Parent.Humanoid:TakeDamage(math.random(1,15))
end
end
local ex = Instance.new("Explosion")
ex.Position = script.Parent.Position
ex.Parent = script.Parent
print("Explosion Made")
			

	end)
	
end)

Please help me bcuz im srsly confused

1 comment

0

who down voted me :/

1 answer

✓ Accepted answer

add a print() command to the first line of the local code to see if the script is running. Server scripts only run in the Workspace, server script storage, and maybe lighting. Local scripts only run in the certain player regions. Ensure that the local script runs in a test server.

1 comment

0

it runs the full script, but it seems that it doent respond to on server event

This discussion is preserved as it was. New answers, comments, and votes are closed.