Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Bool not adding into player when done via server?

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)

2 comments

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.

0

This was a server script, but yellp got me fixed up!

1 answer

✓ Accepted answer

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

This discussion is preserved as it was. New answers, comments, and votes are closed.