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

Bool not adding into player when done via server?

Asked by 6 years ago

This works on solo, but not on client, any advice?


game.Players.PlayerAdded:Connect(function(plr) plr.CharacterAdded:Connect(function(c) local v = Instance.new("BoolValue", c) v.Name = "pistolTouch" v.Value = false end) end)
0
Because you are having the client create an object that's supposed to be visible by server and everyone else. You can't do that via a LocalScript. WoolHat 53 — 6y
0
This was a server script, but yellp got me fixed up! DinozCreates 1070 — 6y

1 answer

Log in to vote
1
Answered by
yellp1 193
6 years ago

Something could be wrong with the name of players. Try this instead

game:GetService("Players").PlayerAdded:Connect(function(plr)
    plr.CharacterAdded:Connect(function(c)
        local v = Instance.new("BoolValue", c)
        v.Name = "pistolTouch"
        v.Value = false
    end)
end)

if that still doesn't work, then you can try adding print functions in to see what functions are messing up

game:GetService("Players").PlayerAdded:Connect(function(plr)
    print("Player Joined")
    plr.CharacterAdded:Connect(function(c)
        print("Character added")
        local v = Instance.new("BoolValue", c)
        v.Name = "pistolTouch"
        v.Value = false
    end)
end)

Hoped this helped

Ad

Answer this question