Hello! I tried making this script that clones a PromixityPrompt when health is low inside the head of a character, yet when I test it, it won't appear to me but only to the player with low health.
Here are the scripts, please help...
LocalScript in StarterPlayerScripts.
local plr = game:GetService("Players").LocalPlayer
local char = plr.Character or plr.CharacterAdded:wait()
repeat wait() until char:FindFirstChild("Humanoid")
local humanoid = char.Humanoid
local walkspeed = tonumber(humanoid.WalkSpeed)
local db = false
humanoid.HealthChanged:Connect(function()
if db == false then
if humanoid.Health <= 150 then
db = true
game.ReplicatedStorage.RemoteEvents.Draining:FireServer(plr)
--end
end
else
if humanoid.Health >= 150 then
db = false
game.ReplicatedStorage.RemoteEvents.DrainingSTOP:FireServer(plr)
end
end
end)
ServerScript in StarterCharacterScripts.
game.ReplicatedStorage.RemoteEvents.Draining.OnServerEvent:Connect(function(plr)
local x = script.Drain:Clone()
x.Parent = plr.Character.Head
x.Enabled = true
plr.Character.Humanoid.WalkSpeed = 0
game.ReplicatedStorage.RemoteEvents.DrainingSTOP.OnServerEvent:Connect(function()
x:Destroy()
plr.Character.Humanoid.WalkSpeed = 16
end)
end)
