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
My Code:
01 | -- if You Haven't Put CanCollide to false |
02 | script.Parent.CanCollide = false |
03 |
04 | script.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 |
08 | end ) |
09 |
10 | -- If This Did not work reply to me thanks |
Wouldn't you just do;
1 | script.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.
okay, first make a local script so the object disappears for the player only.
first, make the part can collide just in case
1 | script.Parent.CanCollide = false |
Once you do that add this in the same script:
1 | script.Parent.Touched:Connect( function () -- Touch Event |
2 | script.Parent:Destroy() -- destroy |
3 | end ) -- ending first line |
full code:
1 | script.Parent.CanCollide = false |
2 | script.Parent.Touched:Connect( function () -- Touch Event |
3 | script.Parent:Destroy() -- destroy |
4 | end ) -- ending first line |
how it works:
when the player touches it it will destroy for only them.