Also the GUI is activated by touching a block I need someone to help make it work in game. The gui dosent have any code. So the reason it wont work is likely in the script. Heres the script. If I need to add any script the gui itself please give the code. But heres the script now. The gui Is called "Message"
local debounce = true
function onTouched(part) if part.Parent == nil then return end local h = part.Parent:findFirstChild("Humanoid") if (h~=nil) then if h.Health == 0 then return end local thisplr = game.Players:findFirstChild(h.Parent.Name) if (thisplr~=nil) then local cash = thisplr:findFirstChild(script.Parent.Parent.Name)
if (debounce == true) and (cash.Value == 1) then
if thisplr == nil then return end
debounce = false
if thisplr == nil then return end
local h = thisplr.PlayerGui.Message.msg1
h.Visible = true
h.Text = "You Already Got This Star."
wait(4)
if thisplr == nil then return end
h.Visible = false
debounce = true
if (script.Parent.Parent.Return.Value == true) then
if thisplr.Character == nil then return end
wait(0.1)
thisplr.Character.Torso.Anchored = true
thisplr.Character.Head.Anchored = true
wait(0.5)
thisplr.Character.Torso.Anchored = false
thisplr.Character.Head.Anchored = false
end
elseif (cash.Value == 0) and (debounce == true) then
if thisplr == nil then return end
debounce = false
thisplr.Checkpoint.Value = Vector3.new(-1,-1,-1)
local h = thisplr.PlayerGui.Message.msg1
h.Visible = true
h.Text = script.Parent.Parent.StarDes.Value
wait(0.1)
cash.Value = 1
thisplr.leaderstats.Stars.Value = thisplr.leaderstats.Stars.Value + 1
thisplr.totalstars.Value = thisplr.totalstars.Value + 1
wait(4)
if thisplr == nil then return end
h.Visible = false
if (script.Parent.Parent.Return.Value == true) then
if thisplr.Character == nil then return end
if thisplr == nil then return end
if thisplr.Character == nil then return end
wait(0.1)
thisplr.Character.Torso.Anchored = true
thisplr.Character.Head.Anchored = true
wait(0.5)
thisplr.Character.Torso.Anchored = false
thisplr.Character.Head.Anchored = false
end
debounce = true
end
end
end
end
script.Parent.Touched:connect(onTouched)

3 comments
Please put your code in the code blocks properly.
:findFirstChild() is decaperated use :FindFirstChild()
cant you only modify the player gui in game from local scripts?