I have a ScreenGui in StarterGui, and its Visible property is false by default. When an event is fired, I want it to be visible to the player that fired the event only. However, when the event fires it becomes visible to all players.
Should I be storing it in PlayerGui or something?
EDIT: This causes the gui to disappear on every player's screen. EM is off.
game.Workspace.StartLine.Touched:connect(function(p) if p.Parent.Name == "Car" then script.Parent.Visible = false end end)
It's really confusing me because this code works for a different GUI.
local ReplicatedStorage = game:GetService("ReplicatedStorage") local chooseCar = ReplicatedStorage:WaitForChild("chooseCar1") script.Parent.Visible = true script.Parent.MouseButton1Click:connect(function(p) script.Parent.Visible = false chooseCar:Fire() end)
Pretty normal, every client will detect that touch.
One thing I don't understand is line 7 of script 2, you're doing chooseCar:Fire()
It should be either FireClient or FireServer (depending on client - server or reversed)
My answer would be to put a string value inside the car and giving it the name of the player.
Like this
game.Workspace.StartLine.Touched:connect(function(p) if p.Parent.Name == "Car" and p.Parent:FindFirstChild('Owner') and p.Parent:FindFirstChild('Owner').Value == game.Players.LocalPlayer.Name then script.Parent.Visible = false end end)