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

Character added works with remote event however...?

Script that gets fired everytime a character is added(CharacterAdded)

game.ReplicatedStorage.RemoteEvents.characterAdded.OnServerEvent:Connect(function(player)
	wait(0.1)
	workspace:FindFirstChild(player.Name).Humanoid.MaxHealth = (player.Stats.Strength.Value*2)+(player.Stats.Vitality.Value*4)+100
end)

The script is supposed to get the current value of strength and vitality of the player, however when I reset the value stays the same with strength and vitality being 1, always giving the player 106 health each time i respawn even with the value of strength and vitality being already greater than 1

1 comment

0

btw just found out that the script works but doesn't print even though it works as long as it gets fired from remoteevent lol

1 answer

I GOT IT LOL FINALLY THE PROBLEM WAS SINCE THE LOCAL SCRIPT ONLY CHANGES THE VALUE ON THE CLIENT (it showed 10 on the client, yet 1 on the server) IT ALWAYS RETURNED 1. SO WHAT I DID WAS I PASSED THE LOCAL VALUE(CLIENT VALUE) OF STRENGTH AND VITALITY TO THE SERVER SCRIPT THEN USED THAN INSTEAD OF USING THE VALUES OF STRENGTH AND VITALITY ON THE SERVER.

Client: https://ibb.co/jQSG98 Server: https://ibb.co/gakgbo

2 comments

0

But making it interact with other players this way would be a bother hmm.

0

It seems i would have to change the values on the server itself.

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