Make a part destroy localy? ( Advance ) !
When a player steps on a part it gets destroyed only for him, but not for others.
Example (not important) - In my game, you can collect stars as a currency basically, but so far when you collect the star it gives you 1 point and the star remains there making people confused if they really touched the part.
1 | script.Parent.Touched:Connect( function (hit) |
2 | local humanoid = hit.Parent:FindFirstChild( "Humanoid" ) |
3 | if humanoid ~ = nil then |
4 | script.Parent:Destroy() |
Here is the full script I made ( you can edit this if you want, It will take more time tho).
[ script inside a part ]
01 | local Popup = script.Parent.Star |
03 | local part = script.Parent |
04 | local function onTouched(part) |
05 | if part.Parent:FindFirstChildOfClass( "Humanoid" ) then |
06 | local player = game.Players:GetPlayerFromCharacter(part.Parent) |
07 | if player and not Debounces [ player.UserId ] then |
08 | Debounces [ player.UserId ] = true |
10 | local Gui = Popup:Clone() |
11 | Gui.Parent = player:WaitForChild( "PlayerGui" ) |
13 | game.ReplicatedStorage.NothingToSeeHere.AddStars:FireClient(player) |
21 | part.Touched:Connect(onTouched) |
22 | local Star = script.Parent |
24 | Star.CFrame = Star.CFrame * CFrame.fromEulerAnglesXYZ( 0.1 , 0 , 0 ) |