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.
script.Parent.Touched:Connect(function(hit) local humanoid = hit.Parent:FindFirstChild("Humanoid") if humanoid ~= nil then script.Parent:Destroy() -- making this local end end)
Here is the full script I made ( you can edit this if you want, It will take more time tho). [ script inside a part ]
local Popup = script.Parent.Star local Debounces = {} local part = script.Parent local function onTouched(part) if part.Parent:FindFirstChildOfClass("Humanoid") then local player = game.Players:GetPlayerFromCharacter(part.Parent) if player and not Debounces[player.UserId] then Debounces[player.UserId] = true local Gui = Popup:Clone() Gui.Parent = player:WaitForChild("PlayerGui") Gui:Play() game.ReplicatedStorage.NothingToSeeHere.AddStars:FireClient(player) wait(2) Gui:Destroy() --Debounces[player.UserId] = false ( inactive ) end end end part.Touched:Connect(onTouched) local Star = script.Parent while true do Star.CFrame = Star.CFrame * CFrame.fromEulerAnglesXYZ(0.1, 0, 0) wait() end
You are confusing yourself with this one, Its okay, I did too when I had a problem like this. To remove a part locally you will just use one localscript in your starterplayer. Remote Events only function when you want to locally send a message to the server, not a server event to client. You will need to use a localscript along the lines of this:
game.Workspace.Part.Touched:Connect(function(hit) -- assume the 'Part' is your star local player = Players:GetPlayerFromCharacter(hit.Parent) if player == game.Players.LocalPlayer then game.Workspace.Part:Destroy() end end)