I am trying to make a script where Text will appear when you hit a winpad after an obby saying +10 points!, but For whatever reason it seems to not work. Is there a setting that could be on the text that makes it so it cannot change? The signals for "working" and "done" also work.
Here is what my StarterGui Folder looks like Here
db = false script.Parent.Touched:connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then local add = game.StarterGui.Add.Points if db == false then print("working") db = true add.Text = "+10 points" add.TextTransparency = 0 wait(3) add.TextTransparency = 1 add.Text = "+0 points" db = false print("done") end end end)
StarterGui is named startergui for a reason. its the gui you get when you just join the game. So do this:
db = false script.Parent.Touched:connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then local add = game.Players[hit.Parent.Name].PlayerGui.Add.Points if db == false then print("working") db = true add.Text = "+10 points" add.TextTransparency = 0 wait(3) add.TextTransparency = 1 add.Text = "+0 points" db = false print("done") end end end)
And yes this will work. DuckyRoblox's script was much longer and chunkier so use this.
For this I would use local script 100% so first heres your script so we would need to define player cause startergui doesnt control anything in live game so we gotta define PlayerGui
db = false--debounce script.Parent.Touched:connect(function(hit)--Function of touched local player = game.Players.LocalPlayer--Get player Locally local plrgui = player:WaitForChild("PlayerGui")--Gets playergui if hit.Parent:FindFirstChild("Humanoid") then --Checks if humanoid touched local add = plrgui.Add.Points-- defines gui for player if db == false then--If db = false then do print("working")--Prints working db = true--debounce = true add.Visible = true--Makes text visible just incase it wasn't visible add.Text = "+10 points" --Makes text that add.TextTransparency = 0--makes transparency 1 Visible wait(3)--debounces wait time add.TextTransparency = 1--Makes transparency 0 Invisible add.Text = "+0 points"--Makes text that db = false --Makes db = false print("done") --Prints done end--ends debounce end--Ends hit statement end) --Ends Function
Ok so basically I explained most of it and the problem accept if helps