Hey guys, I’m a starter scripter and I need some help with this, I don’t know what’s going on, but the function isn’t working at all for some reason. It doesn’t respond to print scripts and such. There are no errors at all but the function isn’t working. Any clue on what’s going on?
local Gui = script.Parent
local reloadTime = 24.5
local Handle = Gui.Parent.Handle
local microwaveSound = Handle.MicrowaveSound
local InteractButton = Gui.InteractButton
local Debounce = false
InteractButton.MouseButton1Click:Connect(function()
print("it works")
if Debounce == false then
Debounce = true
microwaveSound:Play()
wait(reloadTime)
Debounce = false
end
end)
I put it on a localscript but it still doesn’t work, also the InteractGUI is visible on my screen, and the tool parent is Workspace (until it gets picked up)
local Gui = script.Parent
local reloadTime = 24
local Handle = Gui.Parent.:WaitForChild("Handle")
local microwaveSound = Handle:WaitForChild("MicrowaveSound")
local InteractButton = Gui:WaitForChild("InteractButton")
print("loaded")
local Gui = script.Parent
local reloadTime = 24
local Handle = Gui.Parent:WaitForChild(“Handle”)
local microwaveSound = Handle:WaitForChild(“MicrowaveSound”)
local InteractButton = Gui:WaitForChild(“InteractButton”)
print("loaded")
local Debounce = false
InteractButton.MouseButton1Click:Connect(function()
print("it works")
if Debounce == false then
Debounce = true
microwaveSound:Play()
wait(reloadTime)
Debounce = false
end
end)
I just checked, localScripts inside tools run only when you pick them up, but screenGuis don’t get enabled when you pick it up. Are you sure you are testing with the right button?
The ScreenGui appears on my screen when I pick up the tool though
Edit: Oh sorry didn’t really understand your message, I’m currently using a normal script right now, so the ScreenGui pops up.