Attribute change only changing on server

Basically im changing an attribute Endlag to false when an event fires, this event fires basically when i do a move/skill, when i do the move/skill the first time everything works fine and the client can see that endlag has been set to false, but the second time it only sets on the server and not the client:

game.ReplicatedStorage.Remotes.Potioner.OnServerEvent:Connect(function(plr, event, potioner)
	local char = plr.Character
	local hrp = char.HumanoidRootPart
	if char:GetAttribute("Stunned") then return end

	if event == "Potioner" then
		local Potioner = game.ReplicatedStorage.Effects.Potioner:Clone()
		Potioner:PivotTo((hrp.CFrame * CFrame.new(0,0,-4)) * CFrame.Angles(0, math.rad(270), 0) * CFrame.new(0,2,0))
		Potioner.Parent = workspace.Effects
		game.ReplicatedStorage.Remotes.Potioner:FireClient(game.Players:GetPlayerFromCharacter(char), Potioner)
	else
		print("yo")
		PotionEffects[event](char)
		char:SetAttribute("Endlag", false)
		task.delay(0.5, function()
			char:SetAttribute("Endlag", false)
		end)
		print(char:GetAttribute("Endlag"))
		potioner:Destroy()
	end
end)
2 Likes

ngl didnt read your code, only the title

however, you cant change an attribute on the server without it changing on the client aswell

1 Like

where are you setting endlag to true

1 Like
game.ReplicatedStorage.Remotes.Potioner.OnServerEvent:Connect(function(plr, event, potioner)
	local char = plr.Character
	local hrp = char.HumanoidRootPart
     local stunned = char:Get attribute("Stunned")
	if not stunned then return end

	if event == "Potioner" then
		local Potioner = game.ReplicatedStorage.Effects.Potioner:Clone()
		Potioner:PivotTo((hrp.CFrame * CFrame.new(0,0,-4)) * CFrame.Angles(0, math.rad(270), 0) * CFrame.new(0,2,0))
		Potioner.Parent = workspace.Effects
		game.ReplicatedStorage.Remotes.Potioner:FireClient(game.Players:GetPlayerFromCharacter(char), Potioner)
	else
		print("yo")
		PotionEffects[event](char)
		char:SetAttribute("Endlag", false)
		task.delay(0.5, function()
			char:SetAttribute("Endlag", false)
		end)
		print(char:GetAttribute("Endlag"))
		potioner:Destroy()
	end
end)

Try this?

1 Like