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

how do i make coin disappear forever for player who touched it? (CLOSED)

Asked by 4 years ago
Edited 4 years ago

So i was making with friend obby game with coins, and i don't know how to make coin disappear forever cause when you rejoin it appears. Please help? btw im new at scripting

0
I cant give you the entire script but my suggestion would be learn remote events and dataStore mikey2019d 43 — 4y
0
I Think You would Have To Use Data Stores For That To Work Magicdevice3 58 — 4y
0
Also Maybe A Local Part If You Want It For ONLY A player I Cant Give A Script As I am Not Good At Data Stores Magicdevice3 58 — 4y

3 answers

Log in to vote
1
Answered by 4 years ago

My Code:

01-- if You Haven't Put CanCollide to false
02script.Parent.CanCollide = false
03 
04script.Parent.Touched:Connect(function() -- Touch Event
05    script.Parent.Visible = false -- Will Make the coin invisible
06    -- if You Want To Add Score to label:
07    name = name + 1
08end)
09 
10-- If This Did not work reply to me thanks
0
This is without datastore Tho HKprogram 48 — 4y
0
please be more descriptive raid6n 2196 — 4y
0
and visible isnt a property of part raid6n 2196 — 4y
0
and visible isnt a property of part raid6n 2196 — 4y
0
@raid6n Oh I am stupid Im so sorry for my english. i will make a new comment HKprogram 48 — 4y
Ad
Log in to vote
0
Answered by 4 years ago

Wouldn't you just do;

1script.Parent.Touched:Connect(function(hit)
2-- Data store
3:Destroy()

Above the destroy script, you'd do your datastore. I have not tested though; Don't quote me.

0
i would not upvote because you have 69 points lmao CaIcuIati0n 246 — 4y
Log in to vote
0
Answered by
raid6n 2196 Moderation Voter Community Moderator
4 years ago

okay, first make a local script so the object disappears for the player only.

first, make the part can collide just in case

1script.Parent.CanCollide = false

Once you do that add this in the same script:

1script.Parent.Touched:Connect(function() -- Touch Event
2    script.Parent:Destroy() -- destroy
3end) -- ending first line

full code:

1script.Parent.CanCollide = false
2script.Parent.Touched:Connect(function() -- Touch Event
3    script.Parent:Destroy() -- destroy
4end) -- ending first line

how it works:

when the player touches it it will destroy for only them.

0
Honestly, destroying a part isn't the best way. Because you can't get it back. I would simply just set transparency to false! Nicholas1088 169 — 4y

Answer this question