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

How do I make a GUI specific to one character?

Asked by 6 years ago
Edited 6 years ago

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)
0
Filtering enabled. MachoPiggies 526 — 6y
0
What about it? Lord_Pear 6 — 6y
0
Enable it. MachoPiggies 526 — 6y
0
Wait don't listen to me... MachoPiggies 526 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

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)
0
I'll try that, thanks. The :Fire() is to another local script. Dunno if I should be doing that but it seems to work anyway. Lord_Pear 6 — 6y
0
Are you using remote events? User#20388 0 — 6y
0
Bindable Lord_Pear 6 — 6y
0
Hm, Okay, then :Fire can be correct (never use bndable events) User#20388 0 — 6y
Ad

Answer this question