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

How Do You Change Text Label Text For Only One Person?

Asked by 3 years ago
Edited 3 years ago

I'm decently new to scripting and I made a game where you find things around the map and once you touch them a Text Lable pops up saying you found it but if you touch it again it will say you already found it. But if somebody else in the server touches it and then you touch it it will say you already found it because I'm using a script that changes the text when somebody touches it is there a way to get around this? Here is my code.

Popup = script.Parent.ScreenGui Ready = true function onTouch(hit)

01local h = hit.Parent:FindFirstChild("Humanoid")
02if h ~= nil and Ready == true then
03    Ready = false
04    local plyr = game.Players:FindFirstChild(h.Parent.Name)
05    local c = Popup:clone()
06    c.Parent = plyr.PlayerGui
07    wait(3)
08    c:remove()
09    wait(1)
10    Ready = true
11    script.Parent.Touched:Connect(function()
12        script.Parent.RR.TextLabel.Text = "You Already Found This Blank"
13        script.Parent.RR.TextLabel.TextScaled = true
14    end)
15end

end

script.Parent.Touched:connect(onTouch)

Edit:Pretend the code thats out of the script thingy is in it lol

2 answers

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

Hello! For simplicity, I recommend changing the touched function to a proximity prompt or click. That way, just say:

01This is a server script btw
02— insert a boolean value thats false
03— insert a string value that is blank
04local winner = game.Workspace.Winner
05 Local done = Game.Workspace.Done
06Local Prompt  = script.Parent.Prompt
07If done.Value == true then
08Prompt.Triggered:Connect(function(Plr)
09winner = plr
10else
11Warn(plr..”is not the winner!”)
12end

—Local Script In starter gui—-

01local winner = game.Workspace.Winner
02 
03 Local done = Game.Workspace.Done
04Local LocalPlr = game.Players.LocalPlayer
05repeat
06wait()
07If done.Value == true then
08If winner == LocalPlr then
09script.Parent.WinnerScreen.Enabled = true
10 
11script.Parent.WinnerScreen.TextBox.Text = “You did it!”
12 
13Else
14script.Parent.WinnerScreen.TextBox.Text = winner..” has already found this!”
15script.Parent.WinnerScreen.Enabled = true
16Until 1 == 2

Tell me if this won’t work! Thanks! -Leo

Ad
Log in to vote
0
Answered by 3 years ago

I'm answering instead of replying so you'll see it lol but i get that it would be much simpler if i used a click or proximity prompt but I'm trying to get a style similar to what find the chomiks is doing and it would be a lot harder to hide things in walls and such if i were to use a proximity prompt. Could i do it with a touched event?

0
Try using a click LeoPlaysGames_RBX 26 — 3y
0
I will update it to make it so it can use a touched event LeoPlaysGames_RBX 26 — 3y
0
I will update it to make it so it can use a touched event LeoPlaysGames_RBX 26 — 3y
0
well no you can make the prompt so it only works if someone is VERY close to the prompt LeoPlaysGames_RBX 26 — 2y

Answer this question