I am trying to have a prompt for when its triggered, gives me 10 currency and deletes the npc, but idk how to delete the npc, this is what i have as of now:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local InteractEvent = ReplicatedStorage:WaitForChild("InteractEvent")
local Players = game:GetService("Players")
InteractEvent.OnClientEvent:Connect(function(player, npc)
if not npc or not npc:IsDescendantOf(workspace) then return end
local humanoid = npc:FindFirstChild("Humanoid")
if not humanoid then return end
npc:Destroy()
local stats = player:FindFirstChild("leaderstats")
if stats then
local currency = stats:FindFirstChild("¥ZY")
if currency then
currency.Value += 10
end
end
end)
and this is the script in the proximityprompt
local prompt = script.Parent
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local event = ReplicatedStorage:WaitForChild("InteractEvent")
prompt.Triggered:Connect(function(player)
event:FireClient(player, prompt.Parent)
end)```
the proximity prompt is in the npc model
** You are now Level 4! **