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.

local coin=game.Workspace.coin--replace this with where the coin is
local collectsfx=game.ReplicatedStorage.coinsound--this is optional
local debunk=false

coin.Touched:connect(function(hit)
    if game.Players:FindFirstChild(hit.Parent.Name) and coin.Transparency==0 and debunk==false then
        debunk=true
        collectsfx:Play()
        print("coin collected")
        local plr=game.Players:FindFirstChild(hit.Parent.Name)
        repeat
            coin.Transparency=coin.Transparency+0.05
            wait(0.05)
        until coin.Transparency==1
        coin.CanCollide=false
        --any extra code below (eg giving the player a +coin value
    end
end)

Answer this question