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

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

Asked by 5 years ago

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

Log in to vote
1
Answered by 5 years ago

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.

0
I was thinking of being able to use the function with multiple scripts but that's fine too I guess, thanks. SirLuisFonsi 9 — 5y
0
nevermind i forgot to add "+ x" at the end now i fixed it and it works, thanks anyways. SirLuisFonsi 9 — 5y
0
Np. mixgingengerina10 223 — 5y
Ad

Answer this question