#If clause wont work

1 messages · Page 1 of 1 (latest)

slender vessel
#

I got no error nor warnings related to it

#

Here's script for reference:


cd = false

script.Parent.Touched:Connect(function(hit)
    local Players = game:GetService("Players")
    local model = hit.Parent
    local hum = model:WaitForChild("Humanoid")
    local parts = model:GetChildren()
    local speed = script.Parent.Parent.Parent.Gearbox.Speed.Value
    if hum and not hum:HasTag("sprayed") and speed ~= 0 and not cd then
        hum:AddTag("sprayed")
        print("cherry")
        cd = true
        local ColorVal = script.Parent.Parent["Color monitor"].Value.Value
        if ColorVal == 1 then
            print("waow")
            Players.PlayerAdded:Connect(function(plr)
                print("dang")
                plr.CharacterAdded:Connect(function(plrchar)
                    print("wtf")
                    plrchar["Body Colors"].HeadColor3 = Color3.fromRGB(255,0,0)
                    plrchar["Body Colors"].LeftArmColor3 = Color3.fromRGB(255,0,0)
                    plrchar["Body Colors"].RightArmColor3 = Color3.fromRGB(255,0,0)
                    plrchar["Body Colors"].LeftLegColor3 = Color3.fromRGB(255,0,0)
                    plrchar["Body Colors"].RightLegColor3 = Color3.fromRGB(255,0,0)
                    plrchar["Body Colors"].TorsoColor3 = Color3.fromRGB(255,0,0)
                end)
            end)
(...)
end)```
#

the (...) stands for the rest of the script, i cut it at red only to focus better on testing

little canyon
#

cherry does not print?

slender vessel
#

it doesnt work