I am about to release my newest game but I can’t quite get this healing system to work.
What have you tried?
I have tried putting a proximityprompt inside the StarterCharacter’s Torso and disabling it for the torso’s owner only. The problem with that is that the prompt will not trigger.
Here is the script: (Server script inside the prompt)
script.Parent.Triggered:Connect(function(player)
print("triggered!")
script.Parent.Parent.Parent:FindFirstChild("Humanoid").Health = 100
game.ReplicatedStorage.EventsAndFunctions:FindFirstChild("Heal"):FireAllClients(player.Name, script.Parent.Parent.Parent.Name)
end)
The event (above) that is being fired simply shows everyone who was healed. (It also does not work. This is inside a text label in StarterGui)
Script for everyone to see who was healed: (I added a typewriter effect to it. Its a local script)
local replicatedStorage = game:GetService("ReplicatedStorage")
local function displayHealed(text)
local split = string.split(text, "")
script.Parent.Text = ""
for i, v in pairs(split) do
script.Parent.Text = script.Parent.Text .. v
wait(0.1)
end
wait(3)
script.Parent.Text = ""
end
script.Parent.Text = ""
replicatedStorage:FindFirstChild("EventsAndFunctions"):FindFirstChild("Heal").OnClientEvent:Connect(function(healerName, healedName)
local text = tostring(healerName) .. " has healed " .. tostring(healedName)
displayHealed(text)
end)
Also, here is the script that disables the proximity prompt for the torso owner. (Inside StarterCharacterScripts. Its a local script)
local character = script.Parent
wait()
local torso = character:FindFirstChild("Torso")
torso:FindFirstChild("Heal").Enabled = false
By the way, no errors appeared inside the output.