Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

3 comments

0

I cant give you the entire script but my suggestion would be learn remote events and dataStore

0

I Think You would Have To Use Data Stores For That To Work

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

3 answers

My Code:

-- if You Haven't Put CanCollide to false
script.Parent.CanCollide = false

script.Parent.Touched:Connect(function() -- Touch Event
	script.Parent.Visible = false -- Will Make the coin invisible
	-- if You Want To Add Score to label:
	name = name + 1
end)

-- If This Did not work reply to me thanks

5 comments

0

This is without datastore Tho

0

please be more descriptive

0

and visible isnt a property of part

0

and visible isnt a property of part

0

@raid6n Oh I am stupid Im so sorry for my english. i will make a new comment

Wouldn't you just do;

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

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

1 comment

0

i would not upvote because you have 69 points lmao

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

first, make the part can collide just in case

script.Parent.CanCollide = false

Once you do that add this in the same script:


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

full code:

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

how it works:

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

1 comment

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!

This discussion is preserved as it was. New answers, comments, and votes are closed.