hi i was making this game with my friend and i was working on this secret button i made this script but it doesnt function like it is supposed to i mean it only shows the first gui thats all but its supposed to show that then wait 5 seconds and teleport u into a black room and turn on a secret song and if u try press it again it will show a dark message but doesnt work can u tell me what i did wrong? heres the link idk how to paste code here https://pastebin.com/9Tcg9Cp7
my script doesnt work can you please help me fix my script?
1 answer
You can put in code using the Lua symbol at the top with all the formatting options.
local player = game.Players.LocalPlayer
local db = true
script.Parent.MouseButton1Click:Connect(function()
if db == true then
script.Parent.Parent.Parent.Secret.Enabled = true
wait (5)
script.Parent.Parent.Parent.Secret.Enabled = false
script.Parent.Parent.Parent.Parent.Workspace.Secret:Play()
script.Parent.Parent.Parent.Parent.Workspace.Music2:Stop()
script.Parent.Parent.Parent.Parent.Workspace.RegMusic:Stop()
player.Character:MoveTo(Vector3.new((-1376, 18.5, -492))
db = false
else
script.Parent.Parent.Parent.Secret.TextLabel.Text = "There is no Escape"
script.Parent.Parent.Parent.Secret.TextLabel.BackgroundColor3 = Color3.fromRGB(0,0,0)
script.Parent.Parent.Parent.Secret.Enabled = true
wait (5)
script.Parent.Parent.Parent.Secret.TextLabel.Text = "helo der hou r u?????????///"
script.Parent.Parent.Parent.Secret.TextLabel.BackgroundColor3 = Color3.fromRGB(255,255,255)
script.Parent.Parent.Parent.Secret.Enabled = false
wait(5)
game.Players.LocalPlayer.Character.Humanoid.Died:connect(function()
db = true
end)
end
end)
7 comments
ok but how do i fix the damn script
I just typed it out for you. There were multiple things that needed fix such as changing humanoidrootpart.Position to character:MoveTo() and changing backgroundcolor3s from brickcolor to actual color3's (also tried to fix formatting but SH sometimes messed it up)
oh ty btw one more thing i tried this script on a npc: Script.parent.Humanoid.Died:connect(function() script.parent
But when i register a function to humanoid died it doesnt work can u tell me why?
Your script doesnt work it doesnt tp me to the area it just shows the same result as last time
Dude you can't just copy and paste somebody's script and hope it works you need to adapt it to your game. Try and troubleshoot it for once, if script.Parent.Humanoid.Died isn't working you're probably not doing it on an actual character or humanoid.
what does that mean?
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
Oh also can u teach me how do i put code here
Uhhh.... There is a Lua sign above the answer box...