Help With Gun Rotation System

Is your KillsStat.Value above one in the first place?

Yep, I change it when I join. Oh right, how would I make it loop check?

If you change the value after you joined, it’s not gonna work as the script only runs one time.

What you can do is either set the value to one before starting the play test or make a loop check.

How would I make it loop? (30 limit limit)

There’s different methods you could do.

You can just go with a simple while wait() do. Go with the one you’d like.

oh! while true do at top (30 limit)
and a wait() under?

You can do that, but you can also do while wait() do.

So while wait() do under the first line of the giving part?

Yeah.

while wait() do
    -- Your code here.
end
while wait() do
	local Player = game.Players:GetPlayerFromCharacter(script.Parent)
	local KillsStat = Player.leaderstats.Kills.Value

	local Players = game:GetService("Players")
	if Player and Player.Character then
		local humanoid = Player.Character:FindFirstChildOfClass("Humanoid")
		local tool = game.ReplicatedStorage.Gun
		if KillsStat == 1 then
			humanoid:EquipTool(tool)
		end
	end
end

Oh my gosh! It works now! Thank you for your time and help!

1 Like

You should be good to go. Let me know if there’s a bug.

No problem! It’s a pleasure to help.