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

Why does my Remote Event not receive a numerical value?

I am working on a script that heals the player if he has enough points, when I call the remote event it only sends my user name twice instead of the price. Here is my script:

if Action.Name == "Medkit" then
					local Player = game.Players.LocalPlayer
					local character = Player.Character or Player.CharacterAdded:Wait()
					local humanoid = character:WaitForChild("Humanoid")
					local health = humanoid.Health
					local maxHealth = humanoid.MaxHealth
					local price = (maxHealth-health)*5
					if Mag <= Action.Range.Value and cash.Value >= price and health > 0 then
						Action.Event:FireServer(Player,price) 
						break

When I say print(Player), print(price) the output shows Channy97, Channy97

Any ideas on how to fix this? Thank you.

1 answer

I figured it out. When firing a remote event the player is automatically sent as a parameter. So Action.Event:FireServer(price) needs to be sent instead of Action.Event:FireServer(Player,price)

i.e: Remove "Player"

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