Hello, I want script that will make dissapear a object when player will active a proximity prompt and then spawn on the position of players death
the problem is that second time player will die it give some weird position and I am not sure what these mean
I am not really sure how to fix this
local Inteligence = workspace.Gameplay:FindFirstChild("Inteligence") -- inteligence location
local TargetPlr = nil-- location of player with intelligence
local char = nil
function PlayerGlow(plr) -- glow up the player with intelligence
local Highlight = Instance.new("Highlight")
Highlight.Parent = plr.Character
end
function HideInteligence()
for i, v in ipairs(Inteligence:GetChildren()) do
v.Transparency = 1
end
Inteligence.Main.ProximityPrompt.Enabled = false
end
Inteligence.Main.ProximityPrompt.Triggered:Connect(function(plr) -- functions which will proceed after player will take the intelligence
PlayerGlow(plr)
HideInteligence()
TargetPlr = plr
char = plr.Character
char:FindFirstChild("Humanoid").Died:Connect(function() -- function which will trigger after dies
print("player diednooooo")
char:FindFirstChild("Highlight"):Destroy()
print("no more glow")
Inteligence.Main.ProximityPrompt.Enabled = true
Inteligence:MoveTo(char:FindFirstChild("UpperTorso").position) -- THIS PART OF THE SCRIPT WILL CHANGE THE POSITION
TargetPlr = nil
for i, v in ipairs(Inteligence:GetChildren()) do
print("hell yeah guess who is back")
v.Transparency = 0
v.Anchored = false
end
end)
end)
game:GetService("RunService").Heartbeat:Connect(function()
if TargetPlr ~= nil then
TargetPlr.CharacterAdded:Connect(function(charr)
char = charr
end)
end
end)
also, all the debug stuff got printed. everything works only the position is weird, like its not even an position of the original position
also, the position is not 0,0,0