I have this Script that is inside a Part called "TeleBrick" This script works fine but it is causeing problems and I know why I think it is beuase the Part when it is CFreamed it moves into player adding extra Points. So I want to make it so that when it is Touched, it Destroys and then Adds another part to the Workspace the exact same. Heres the Code:
local Brick = game.Workspace.TeleBrick --Replace this with your brick
Brick.Touched:connect(function(Obj) --Connects the Touched event to an anonymous function
Brick.Transparency = 1
Brick.CFrame = CFrame.new( --Replace the Min and Max in the math.random() with your numbers
math.random(-62.5, 62.5 ),
math.random(3.19, 3.19),
math.random(-62.5, 62.5)
)
Brick.Transparency = 0
if Obj and Obj.Parent then --Making sure the Obj still exists
local Player = game.Players:GetPlayerFromCharacter(Obj.Parent) --Gets the player from the character
if Player then
local PointStat = Player.leaderstats:FindFirstChild("Points") --Replace STAT_NAME with the name of the stat
if PointStat then
PointStat.Value = PointStat.Value + 2 --Change 1 to how many points you want to award
end
end
end
end)
Can anyone help me out here?

1 comment
By the way, I got this Code from someone here on Scripting helpers. That's why there are Instructions.