local AddKillEffects = game.ReplicatedStorage.RemoteEvents.AddKillEffects

local DeathAnim = game.ReplicatedStorage.Animations.Attacked.Death

AddKillEffects.OnServerEvent:Connect(function(Player)
	local Script = Player.Character.ClassCreatorTest
	local Script2 = Player.Character.ShoulderCamToggle
	
	local DeathScreen = Player.PlayerGui.HUD.DeathScreen
	
	local Humanoid = Player.Character.Humanoid
	local HRP = Player.Character.HumanoidRootPart
	
	local SpawnPart = game.Workspace.SpawnPart
	
	local ActiveTracks = Humanoid:GetPlayingAnimationTracks()
	
	local DeathTrack = Humanoid:LoadAnimation(DeathAnim)
	
	local Dead = Player.PlayerValues.Dead
	local Class = Player.PlayerValues.Class
	local Health = Player.PlayerValues.Health
	
	Script.Disabled = true
	Script2.Disabled = true
	
	Humanoid.WalkSpeed = 0
	Humanoid.JumpPower = 0
	
	Dead.Value = true
	
	DeathTrack.Looped = false
	
	DeathTrack:Play() 
	
	repeat wait() until DeathTrack.IsPlaying == false
	
	Humanoid.PlatformStand = true
	
	DeathScreen:TweenPosition(
		UDim2.new(0.177,0,0.256,0),
		Enum.EasingDirection.Out,
		Enum.EasingStyle.Back,
		1,
		true
	)
	
	DeathScreen.Respawn.MouseButton1Up:Connect(function()
		DeathScreen:TweenPosition(
			UDim2.new(0.177,0,-1,0),
			Enum.EasingDirection.In,
			Enum.EasingStyle.Back,
			1,
			true
		)
		
		Dead.Value = false
		
		Humanoid.PlatformStand = false
		
		Script.Disabled = false
		Script2.Disabled = false
		
		HRP.CFrame = SpawnPart.CFrame
		
		if Class.Value == "Splitter" then
			Health.Value = 130
		elseif Class.Value == "Rusher" then
			Health.Value = 110
		end
		
		AddKillEffects:FireClient(Player)
	end)
end)

^^^^^^^^ there is a script i made, everything works flawlessly except the part where i changed health.value to 130/110. pretty self explanitory, but ive really tried my hardest to fix this. this happened on a previous version of this script too can somebody please help?

4 comments

0

Same thing happened to me, my number value didn't even change and my error was "value was nil" even though it's accurate.

0

I think it might be because 130 and 110 is going over the max health limit so it's just changing it to 100, try changing the max health first

0

i see you used "Player" Variable, is this in a LocalScript, because changing things in a local script cannot work server-sided, so it only shows on your screen

0

@DesiredRep im using a custom health system and @CrazyCats84 this is a server script