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

Why can't this print anything even though the weld is in the players right arm?

Asked by 5 years ago
Edited 5 years ago

So if the weld is in the right arm then it should print something. I only want this for a ball

local tool = script.Parent

local function rightGrip()
    if tool.Parent["Right Arm"]:FindFirstChild("RightGrip") ~= nil and tool.OnLeftHand.Value == false then
        local rightWeld = Instance.new("Weld",tool.Parent["Right Arm"])
        rightWeld.c0 = tool.Handle
        rightWeld.c1 = tool.Parent["Right Arm"]
        return true and print("Weld is inside the right arm")
    else end
    end

tool.Activated:Connect(rightGrip)
0
You can ignore the ~= nil that is not necessary. if statments do not let nil or false values through by default. User#21908 42 — 5y
0
Another thing. You can use not instead of == false so here is the final if statement: if tool.Parent["Right Arm"]:FindFirstChild("RightGrip") and not tool.OnLeftHand.Value then User#21908 42 — 5y
0
so how do i make it so that if the rightgrip is not found WillBe_Stoped 71 — 5y
0
its basically if the rightgrip is not found and the value is false then it should make a weld WillBe_Stoped 71 — 5y

Answer this question