Hey There! How come my basic touch script isn’t working?
local StarterGui = game:GetService("StarterGui")
local Gui = StarterGui.GameGui
local BackFrame = Gui.BackgroundFrame
local TextFrame = Gui.TextFrame
local Text = TextFrame.TextLabel
local Debounce = nil
script.Parent.Touched:Connect(function(hit)
if Debounce == nil then
Debounce = 1
BackFrame.Visible = true
TextFrame.Visible = true
Text.Text = "..."
task.wait(5)
Debounce = nil
BackFrame.Visible = false
TextFrame.Visible = false
elseif Debounce == 1 then
return
end
end)
local StarterGui = game:GetService("StarterGui")
local Gui = StarterGui.GameGui
local BackFrame = Gui.BackgroundFrame
local TextFrame = Gui.TextFrame
local Text = TextFrame.TextLabel
local debounceRunning = false
script.Parent.Touched:Connect(function(hit)
if not debounceRunning then
debounceRunning = true
BackFrame.Visible = true
TextFrame.Visible = true
Text.Text = "..."
wait(5)
BackFrame.Visible = false
TextFrame.Visible = false
debounceRunning = false
end
end)
Try tell me if work.
Try this tell me it works.
local Player = game.Players.LocalPlayer
local Gui = Player.PlayerGui.GameGui
local BackFrame = Gui.BackgroundFrame
local TextFrame = Gui.TextFrame
local Text = TextFrame.TextLabel
local debounceRunning = false
script.Parent.Touched:Connect(function(hit)
if not debounceRunning then
debounceRunning = true
BackFrame.Visible = true
TextFrame.Visible = true
Text.Text = "..."
wait(5)
BackFrame.Visible = false
TextFrame.Visible = false
debounceRunning = false
end
end)
Its inside a humanoid so idk if it changes anything, any things u can suggest? @instanitly doesnt work for yours to
You litteraly copy paste what i did and just changed the Player variable
.
1 Like
There is no errors of what i did i don’t know what is not work then, did you tryed what i did ?
1 Like
Yeah I tryed it and it didn’t even register.
Where the script is located what the Parent of it ?
1 Like
the parent is a part inside a Character in the game
That why, a model can’t have touched ? You need a Part for it…
1 Like
the parent is not a model its just inside a model. Is that why?
You can’t get the gui of a player by startergui so for first I would suggest you to get the “PlayerGui” and why do you want to know if a player hit something because you don’t use the variable hit what it is used for ?
Send screenshoot i don’t understand ._.
1 Like
Humanoid can’t even been touched that’s why I think …
1 Like
its a server script and I want it to appear to everyone so surely that works?
1 Like
Ok but what is it supposed to be used for ?
its gonna show text to every player after a player touches that part.
1 Like
Where is the part show us a picture !
Can you show us the model ? ezgezg