Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 5 years ago

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)


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? GamingZacharyC 152 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago
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)
Ad

Answer this question