I started by creating a proximity parented to the player’s torso in the server, the proximityprompt is enabled when the player reaches 1 hp, and the prompt enables but to everyone including the localplayer, so I want the proximityprompt to be enabled, and be visible to everyone except me, I’m a bit lost here
What I’ve personally done for my interaction system.
ProximityPromptService.PromptShown:Connect(function(prompt: ProximityPrompt, inputType: Enum.ProximityPromptInputType)
if prompt.Parent.Name == "Torso" then
if Players:GetPlayerFromCharacter(prompt.Parent.Parent) == Player and prompt.Parent.Parent == Player.Character then
prompt:Destroy()
return
end
end
end)
Essentially, PromptShown detects when the prompt is shown. And if you have the prompt on your torso, usually it’ll attempt to appear immediately. After that, it’ll delete it. PromptShown will only fire a single time per prompt shown. Essentially, you won’t have to use ChildAdded and then consistently get updates when something new is added and then disconnect it once finished.
Create and place the script inside of StarterCharacterScripts so it’ll run every time the character is added.
1 Like
Yo thanks for the reply, I’m gonna try this
make the following:
Client
local players = game:GetService("Players")
local replicatedStorage = game:GetService("ReplicatedStorage")
local proximityPrompt = script.Parent
local event = replicatedStorage.RemoteEvent
local character = players.LocalPlayer.Character
local humanoid = character:WaitForChild("Humanoid")
local healthCheck = 50
humanoid.HealthChanged:Connect(function(health)
if health <= healthCheck then
event:FireServer(proximityPrompt, healthCheck)
end
end)
Server
local replicatedStorage = game:GetService("ReplicatedStorage")
local playerDamageEvent = replicatedStorage.RemoteEvent
playerDamageEvent.OnServerEvent:Connect(function(player, proximityPrompt, healthCheck)
if player.Character and player.Character.Humanoid.Health <= healthCheck then
proximityPrompt.Enabled = true
end
end)
–
A quick damage part script
Server
local damage = 15
local cooldown = 2
local table = {}
script.Parent.Touched:Connect(function(otherPart)
local character = otherPart.Parent
local humanoid = character:FindFirstChildWhichIsA("Humanoid")
local player = game.Players:GetPlayerFromCharacter(character)
if player and humanoid and not table[character] then
humanoid:TakeDamage(damage)
table[character] = true
wait(cooldown)
table[character] = nil
end
end)