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

How can I disable a seat for the player only?

Asked by
zomspi 541 Moderation Voter
5 years ago
Edited 5 years ago

I'm making a car and want only the owner to be able to drive it. I put a string value called 'Owner' inside the seat, the value of that is the owner. I then tried to deactivate the seat for the player if they were not the owner using a local script.

Is there some kind of issue regarding the local script?

1script.Parent.Parent.Changed:Connect(function()
2    local plr = game.Players.LocalPlayer
3if plr.Name == script.Parent.Owner.Value then
4    script.Parent.Disabled = false
5else
6        script.Parent.Disabled = true
7end
8end)

Thanks!

0
maybe this could help you: https://scriptinghelpers.org/questions/100415/how-can-i-make-it-so-that-only-a-certain-player-can-sit-on-a-seat#92762 and make sure it's a server script inside the seat. Mayk728 855 — 5y

1 answer

Log in to vote
1
Answered by 5 years ago

You can't put LocalScript inside the seat like that. put LocalScript in PlayerScript and locate the seat and disabled it

Ad

Answer this question