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

why does this only work for 1 player?

Asked by
Benqazx 108
8 years ago
script.Parent.MouseButton1Click:connect(function()
    local player = script.Parent.Parent.Parent.Parent
    local char = player.Character
    local human = char:FindFirstChild("Humanoid")
    local model = script.Parent.Parent.Model.Value
    local car = script.Parent.Parent.Car.Value
    if human:FindFirstChild(model)~= nil then
        print("Model Found!")
        if human:FindFirstChild(model):FindFirstChild(car) ~= nil then
            print("Car Found!")
            local body = human:FindFirstChild(model):FindFirstChild(car):GetChildren()
            for i,v in pairs (body) do
                if v.Name == "Seat" then
                    v.Disabled = true
                    script.Parent.Parent.Open.Visible = true
                    script.Parent.Visible = false
                end
            end
        end
    end
end)

this script is in a car gui. i am using a local script for this. so basically i want this script to disabled the Seat if it is clicked. but this script only makes the Seat Disabled for 1 player for all the other players the seat is still not disabled. please help

1 answer

Log in to vote
0
Answered by
adark 5487 Badge of Merit Moderation Voter Community Moderator
8 years ago

FilteringEnabled is set to true. Any change made by a LocalScript will only affect the Player controlling that LocalScript, aka the person who clicked the seat.

You need to use a RemoteEvent or RemoteFunction to tell the Server to Disable the Seat for everyone.

0
can you link me with any removeevent stuff please? i am not good with remoteevents much Benqazx 108 — 8y
Ad

Answer this question