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

Why does this only work on the server?

Asked by
Benqazx 108
8 years ago
script.Parent.MouseButton1Click:connect(function()
    local m = script.Parent.Model.Value
    local c = script.Parent.Car.Value
    local p = script.Parent.Parent.Parent.Parent.Name
    local plr = game.Workspace:FindFirstChild(p)
    if plr ~= nil then
        plr:FindFirstChild("Humanoid")
        if plr:FindFirstChild("Humanoid") ~= nil then
            local s = plr:FindFirstChild("Humanoid"):FindFirstChild(m):FindFirstChild(c):GetChildren()
            for i,v in pairs (s) do
                if v.Name == "Seat" then
                    v.Disabled = true
                end
            end             
        end
    end
end)

this is in a server script. this script is in a gui button. this script is meant to disable the seat for everyone in the game if the gui button is clicked but when i test this in 2 player roblox studio this script only disables the seat for the 'Server' it does not disable the seat for the 'Players'. why? please help me

0
You should use a local script to run in screen GUIs and use remote events to trigger a server sided script. User#11440 120 — 8y
0
i did use remote event earlier but that didnt work either. it had the same problem it would work on the server but not for the players Benqazx 108 — 8y
0
For line five, instead of finding the player in workspace, try using .Character on the p variable. I'm just picking out little things at a time? User#11440 120 — 8y
0
ok Benqazx 108 — 8y
0
same thing happens. it works on the server but not for the players Benqazx 108 — 8y

Answer this question