I'm trying to make a script that runs when the specified part is touched and it tells you what difficulty you're in by a GUI coming from the top of the screen but when I test it, I touch the part and then nothing happens. The output doesn't even show a error and I think it's because where the script is placed or something but I don't know the right place for this to work.
local diffReminder = script.Parent:WaitForChild("DifficultyReminder")
local hard = diffReminder.Hard
local med = diffReminder.Medium
local ez = diffReminder.Easy
local debounce = true
local stage = game.Workspace.Stages["2"]
stage.Touched:Connect(function(plr)
if plr:FindFirstChild("Humanoid") then
if plr.leaderstats.Stage.Value >2 then
debounce = false
ez:Destroy()
elseif plr.leaderstats.Stage.Value <2 then
ez:TweenPosition(
UDim2.new(0.1, 0,0.93, 0),
"Out",
"Back",
0.25,
false
)
wait(4)
ez:TweenPosition(
UDim2.new(0.1, 0,-1.93, 0),
"In",
"Back",
0.25,
false
)
end
end
end)
SCRIPT PARENT:
It's a Local Script Inside of StarterGui

3 comments
So I tested your method, I put it the code in a serverscript and i put it inside the part.
When I played the game I still saw no errors in the output but also when i touched it, nothing happened oof. Hope you can try and see why and thanks for helping
I did some edits in the script and also added a print to check whether it is detecting or not