Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

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

Asked by 8 years ago

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

0
who down voted me :/ koolkid8099 705 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago

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.

0
it runs the full script, but it seems that it doent respond to on server event koolkid8099 705 — 8y
Ad

Answer this question