01 | local db = true |
02 | script.Parent.Touched:connect( function (hit) |
03 | if hit.Parent:FindFirstChild( "Humanoid" ) ~ = nil then |
04 | if db = = true then |
05 | db = false |
06 | script.Parent.Transparency = 1 |
07 | local player = game.Players:GetPlayerFromCharacter(hit.Parent) |
08 | player.leaderstats.Bricks.Value = player.leaderstats.Bricks.Value + 1 |
09 | script.Sound:Play() |
10 | wait( 1 ) |
11 | script.Parent:Remove() |
12 | end |
13 | end |
14 | end ) |
So this is the script I made but I dont know how to make it only disappear on your screen but everybody can go get it
Use Remote Events to do this. You make a client remoteevent and connect your script to that user. Probably using this script below
Localscript in StarterGui
1 | game.ReplicatedStorage.RemoteEvent.OnClientEvent:Connect( function (part, method) |
2 | if part and method = = "invis" then |
3 | part.Transparency = 1 |
4 | part.CanCollide = false |
5 | elseif part and method = = "show" then |
6 | part.Transparency = 0 |
7 | part.CanCollide = true |
8 | end |
9 | end ) |
Server Script in Workspace or ServerScriptService
1 | script.Parent.Touched:Connect( function (plr) |
2 | if plr and plr.Parent:FindFirstChild("Humanoid') then |
3 | local player = game.Players:GetPlayerFromCharacter(hit.Parent) |
4 |
5 | game.ReplicatedStorage.RemoteEvent:FireClient(player, script.Parent, "invis" ) |
6 | end |
7 | end ) |
make sure that the local script is in game.Players.StarterPack.StarterScripts or something like that because that way, it will only apply to the player