Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

For some reason my billboard gui Text button is not detecting clicks?

I have it so a billboard goes to my character and I have it so it should connect mousebutton1click but for some reason it does not work

local NetWork = require(game.ReplicatedStorage.NetWork)
local CharNV = require(script.Parent.CharNetVars)
--

CharNV.CharAssets.ArrestGUI.Parent = script.Parent
script.Parent.ArrestGUI.AddFeatures.Handcuff.MouseButton1Click:connect(function(plr)
	print("Clicked")
	print(plr.Character.CharacterSettings.Cop.Value)
	if plr.Character.CharacterSettings.Cop.Value == true then 
		CharNV.CharHumanoid.WalkSpeed = 0
		CharNV.CharHumanoid.JumpPower = 0
		script.Parent.UpperTorso.ArrestGUI.AddFeatures.Visable = false
		script.Parent.UpperTorso.ArrestGUI.RemoveFeatures.Visable = true
	end
end)
script.Parent.ArrestGUI.AddFeatures.Handcuff.MouseButton1Click:connect(function(plr)
	print("Clicked")
		print(plr.Character.CharacterSettings.Cop.Value)
	if plr.Character.CharacterSettings.Cop.Value == true then 
		CharNV.CharHumanoid.WalkSpeed = 16
		CharNV.CharHumanoid.JumpPower = 15
		script.Parent.ArrestGUI.AddFeatures.Visable = true
		script.Parent.ArrestGUI.RemoveFeatures.Visable = false
	end
end)


1 comment

0

i'm not so sure about this, because I've never used the "require" statement, but maybe it is the fact that you are using the require statement and NOT just saying it out in the open?

1 answer

✓ Accepted answer
local handcuff = script.Parent.ArrestGui.AddFeatures.Handcuff
local plr = game:GetService('Players').LocalPlayer
local clicked = false
local h = CharNV.Humanoid

handcuff.MouseButton1Click:Connect(function() -- Connect not connect
    clicked = true
    local add = script.Parent.UpperTorso.AddFeatures
    local remove = add.Parent.RemoveFeatures
    if plr.Character.CharacterSettings.Cop.Value == true then
        if h.WalkSpeed ~= 0 and h.JumpPower ~= 0 then
            h.WalkSpeed = 0
            h.JumpPower = 0
            add.Visible = not remove.Visible -- changes visible to the opposite of remove visible 
            remove.Visible = not add.Visible -- changes visible to the opposite of add visible
        elseif h.WalkSpeed ~= 16 and h.JumpPower ~= 50 then
            h.WalkSpeed = 16
            h.JumpPower = 50
            remove.Visible = not add.Visible 
            add.Visible = not remove.Visible
        end
    end
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.