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

Why does my Remote Function for healing not work yet it doesn't error in the output log?

So I'm working on a medikit tool (not really for a certain game, I'm just trying to learn how to use remote functions and events since FE is now forced on every game), and I've properly set it up and stuff. The problem is, it doesn't seem to work, despite the fact that nothing seems to appear in the output log related to my scripts.

The local script's content is

script.Parent.Parent.Activated:Connect(function()
	game.ReplicatedStorage.Heal:InvokeServer(25)
	script.Parent.Parent:Destroy()
end)

The script is inside a tool's handle.

The server script, which is in ServerScriptStorage, has the following content:

local function heal(player, x)
	player.Character.Humanoid.Health = player.Character.Humanoid.Health
end

game.ReplicatedStorage.Heal.OnServerInvoke = heal

I know I'm doing something wrong since it won't work, but why won't it?

1 answer

✓ Accepted answer

The problem is at line 2 in the server script, which is in ServerScriptStorage, you forgot to add, The line should be like this

player.Character.Humanoid.Health = player.Character.Humanoid.Health + 1

Make sure to change 1 to whatever number you want.

3 comments

0

I was thinking of being able to use the function with multiple scripts but that's fine too I guess, thanks.

0

nevermind i forgot to add "+ x" at the end now i fixed it and it works, thanks anyways.

0

Np.

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