Please Help Me Fix this Code

This script is located under starter player scripts

while game.ReplicatedStorage.ToolsDup.Value == true do
	if game.ReplicatedStorage.Bear.Value == (game.Players.LocalPlayer.Name) then
		game.Players.LocalPlayer.PlayerScripts.Bear = true
		game.Players.LocalPlayer.Character.PunchClient.Disabled = false
		wait(2)
		print("bear")
	else
		game.Players.LocalPlayer.PlayerScripts.Army.Value = true
		local Tool = game.ServerStorage.Tools.Gun:clone()
		Tool.Parent = game.Players.LocalPlayer.Backpack
		wait(2)
		print("army")
	end
end

For some reason it doest change the bear and and army boolean values

Please Help
LargeHotDogs13

1 Like

So I see a few problems with your script.

  1. Your script is probably a local script considering you used game.Players.LocalPlayer and local scripts cannot read server values such as values of ReplicatedStorage and cannot identify when they change. You will need to use a server script for that.

  2. If you want the player value to change, you will need to use a server script so everyone will be able to see the change/it will be a “good method” to change values via a server script than a local unless you cannot access it via a local script.

2 Likes