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

Script not detecting Boolean Value Change?

Asked by 4 years ago

Hi, I made a script where the player chops a tree down when they click with their mouse. I made a boolean to let the script detect when the player clicked because using a touched event didn't work with a local script. I have no idea why this does not work can someone please help me. Thanks.

Click Script (local script):

local plr = game.Players.LocalPlayer

local mouse = plr:GetMouse()

local arm = workspace.Arm1.Union


local axe = workspace.wdaxe


local cam = workspace.Camera

mouse.Button1Down:Connect(function(valuse)

    if script.Parent.Script.swngV.Value == false then

        print("mouse lol")

    script.Parent.Script.swngV.Value = true

    for i = 1, 7 do

        wait()

    end


    wait(.5)


    script.Parent.Script.swngV.Value = false

    end

end)

Chop Down Tree Script (script):

script.Parent.Touched:Connect(function(chop)


    wait(.05)

    if chop.Parent.Name == "Tree" then

        print("tree has been touched okay")

        script.swngV.Changed:Connect(function(ch0p)

        print("wood was chopped")


        script.Parent.WoodHit:Play()



        for i = 1, 7 do

            wait()

        end


        wait(.5)



        end)    


    end



end)

When I use print() it prints when the mouse is clicked and when the axe is touching the tree. But the only thing that seems to be wrong is the Boolean Value since it doesn't print.

0
If you change a value from local script, the server not detect because its only for u 174gb 290 — 4y
0
Yep. Can't do this in the filtering enabled world of Roblox 2019. You have to send a RemoteEvent from client to server. Value objects were the old, insecure way of replicating arbitrary values which is no longer allowed. EmilyBendsSpace 1025 — 4y

Answer this question