How to create Super Mario 64 style star system?

  1. What do you want to achieve? Keep it simple and clear!

Basically, What I want to achieve is a Star System. A player collides with a star the leaderboard goes up one, an animation plays, and then the player gets teleported back to the spawn area. That star can only be collected ONCE on a person’s account.

  1. What is the issue? Include screenshots/videos if possible!

It doesn’t exist. (At least to the public)

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

I know there are coin systems I can build off of. However, most are just crappy and don’t achieve what I want.

Here is what I’m trying to recreate.

Thanks for any help!

3 Likes

A table that uses string keys can’t have duplicates, so just use a table with string keys and bool values, one for each star?

2 Likes

You could try using tags for each star with value objects inside of them.

2 Likes

so like this? https://youtu.be/-tg5zyN3T-c

2 Likes

Yeah! Just after colliding it disappears for that player and cannot be obtained again. The “money” stays though.

2 Likes

now it would delete after 3 sec to let the animation play

3 Likes

ill tell the code in a sec im making it save.

1 Like

Alright. I appreciate the help btw.

coded this kinda quickly so the code might be bad
starstest.rbxl (48.0 KB)

3 Likes

This is pretty good. May I suggest a slight set up change.
Change line 3 in StarHandler to: local Stars = workspace:WaitForChild(“Stars”).
Then move the script to ServerScriptService. Then you would have a type of anti-hacking set up.

2 Likes

i couldnt make it save, would you like to know the scripts?

1 Like

Yes please, if you don’t mind.

1 Like

game.Players.PlayerAdded:Connect(function(Player)
local leaderstats = Instance.new(“Folder”, Player)
leaderstats.Name = “leaderstats”
leaderstats.Parent = Player
local Coins = Instance.new(“IntValue”, leaderstats)
Coins.Value = 0
Coins.Name = “Coins”

game.Workspace["Placement Star"].Touched:Connect(function(hit)
	if hit and hit.Parent:FindFirstChild("Humanoid") then
		local player = game.Players:GetPlayerFromCharacter(hit.Parent)
		wait()
		Coins.Value += 1
		script.Parent:Destroy()
	end
end)

end)

Add this script under the part you are using for a star, if you are using a model, it may not work.

1 Like

Dont use that, im sorry its wrong i was playtesting it and made some changes

WaitForChild wont change anything because the script is parented to the Stars folder and parenting the script to ServerScriptService will only make it invisible to exploiters that cant do anything to the script anyways

game.Players.PlayerAdded:Connect(function(Player)
local leaderstats = Instance.new(“Folder”, Player)
leaderstats.Name = “leaderstats”
leaderstats.Parent = Player
local Coins = Instance.new(“IntValue”, leaderstats)
Coins.Value = 0
Coins.Name = “Coins”

script.Parent.Touched:Connect(function(hit)
	if hit and hit.Parent:FindFirstChild("Humanoid") then
		local player = game.Players:GetPlayerFromCharacter(hit.Parent)
		wait()
		Coins.Value += 1
		script.Parent:Destroy()
	end
end)

end)

2 Likes

use this one it should work the other one wont

3 Likes

make sure to copy even the not colored text on that reply.

2 Likes

I think Czo’s solution works better for me. Thanks for the help though!

1 Like