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

How can I make a player take damage?

I want the player to take damage when they enter the wrong password using serverscript

	if userInput == pinNum then
		
		--Code if user enters correct passwords

	else
		print("wrong")
		screen.Text = "Incorrect Pin"

		--Player take damage

	end

3 comments

0

I assume this is a LocalScript, and then you'll need to tell a Server Script to damage the player, possibly by using a RemoteEvent

0

no this is in the serverscript

0

How do you get userInput in a Server Script?

1 answer

✓ Accepted answer

Get the player who gave the input and do:

Player.Character.Humanoid:TakeDamage(DesiredDamage)

If you have no idea how to get the player, I suggest showing more of the script.

1 comment

0

Thank you, it worked!

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