Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Character added works with remote event however...?

Asked by 5 years ago

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

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 xxXTimeXxx 101 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

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

0
But making it interact with other players this way would be a bother hmm. xxXTimeXxx 101 — 5y
0
It seems i would have to change the values on the server itself. xxXTimeXxx 101 — 5y
Ad

Answer this question