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)
local h = hit.Parent:FindFirstChild("Humanoid") if h ~= nil and Ready == true then Ready = false local plyr = game.Players:FindFirstChild(h.Parent.Name) local c = Popup:clone() c.Parent = plyr.PlayerGui wait(3) c:remove() wait(1) Ready = true script.Parent.Touched:Connect(function() script.Parent.RR.TextLabel.Text = "You Already Found This Blank" script.Parent.RR.TextLabel.TextScaled = true end) end
end
script.Parent.Touched:connect(onTouch)
Edit:Pretend the code thats out of the script thingy is in it lol
Hello! For simplicity, I recommend changing the touched function to a proximity prompt or click. That way, just say:
This is a server script btw — insert a boolean value thats false — insert a string value that is blank local winner = game.Workspace.Winner Local done = Game.Workspace.Done Local Prompt = script.Parent.Prompt If done.Value == true then Prompt.Triggered:Connect(function(Plr) winner = plr else Warn(plr..”is not the winner!”) end
—Local Script In starter gui—-
local winner = game.Workspace.Winner Local done = Game.Workspace.Done Local LocalPlr = game.Players.LocalPlayer repeat wait() If done.Value == true then If winner == LocalPlr then script.Parent.WinnerScreen.Enabled = true script.Parent.WinnerScreen.TextBox.Text = “You did it!” Else script.Parent.WinnerScreen.TextBox.Text = winner..” has already found this!” script.Parent.WinnerScreen.Enabled = true Until 1 == 2
Tell me if this won’t work! Thanks! -Leo
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?