Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

how to make coin that only one player can see and get?

Asked by
zed_103 23
5 years ago

so im trying to make a coin that only one player can see that and get the coin and other players have the same

0
To do that you need to create the coin on the client. Creating things on the client will only allow that client to see the changes. https://developer.roblox.com/en-us/articles/Roblox-Client-Server-Model ForeverBrown 356 — 5y
0
Create the Coin in a local Script RedstonecraftHD 25 — 5y

2 answers

Log in to vote
1
Answered by 5 years ago

This is the easiest method, there are other methods, though.

Have a localscript place the coin in workspace or workspace.CurrentCamera.

Whomever owns the localscript will see the coin.

This is because localscripts are client sided, that said, if a localscript places a part in workspace, and assuming no other player has the same script, the only player(s) who would see it would be the only player(s) to own the localscript.

By "own", I mean the localscript is inside the player's character, playergui, or backpack.

Ad
Log in to vote
-1
Answered by 5 years ago

For this, make a LocalScript and put it in StarterGui.

01local coin=game.Workspace.coin--replace this with where the coin is
02local collectsfx=game.ReplicatedStorage.coinsound--this is optional
03local debunk=false
04 
05coin.Touched:connect(function(hit)
06    if game.Players:FindFirstChild(hit.Parent.Name) and coin.Transparency==0 and debunk==false then
07        debunk=true
08        collectsfx:Play()
09        print("coin collected")
10        local plr=game.Players:FindFirstChild(hit.Parent.Name)
11        repeat
12            coin.Transparency=coin.Transparency+0.05
13            wait(0.05)
14        until coin.Transparency==1
15        coin.CanCollide=false
16        --any extra code below (eg giving the player a +coin value
17    end
18end)

Answer this question