A Group Rank depending Spawn-Button

Hi!

I hope you can help me out:

  1. What do you want to achieve? Keep it simple and clear!
    I wanted to try scripting a group rank depending spawn button.

  2. What is the issue? Include screenshots / videos if possible!
    I’m still learning how to script, so I’m not very sure how to do it properly.

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I looked up on YT-Videos but haven’t found anything yet.

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

Here’s the current script, that came with this model:

-- Domukas3123 click regen script 
-- just place the button to the model

location = script.Parent.Parent.Parent
regen = script.Parent.Parent
save = regen:clone()

function onClicked()
	regen:remove()
	back = save:clone()
	back.Parent = location
	back:MakeJoints()
end 

script.Parent.ClickDetector.MouseClick:connect(onClicked)

I know I shouldn’t ask for hole scripts, but I have absolutely no clue. Every help is much appreciated!

Regards,
-Some

You meant the SpawnPoint for player with a group rank only?

You can find a users rank in a group using RankInGroup, and IsInGroup functions

Though, using a ClickDetector you’ll need to detect what player pressed the button, ClickDetector | Roblox Creator Documentation
Which looking at it’s documentation, the player is passed in the function, so add player into the onClicked arguments, and see if the player is in the group, and if their rank is what you want it to be, and if it is continue to spawn the model/thing.

Yeah, so If a Player in my Group has the Rank let’s say 5 he is allowed to spawn the model. But Someone with less then 5 isn’t allowed.

hmm, If I’m not wrong (I’m on mobile rn)

you can set the player’s SpawnLocation

He’s talking about a model, not a players spawning location.

ohhhhhhh, okay. (30 limt bruh)

i try to read through this, Thanks in advance!

-- Domukas3123 click regen script 
-- just place the button to the model

location = script.Parent.Parent.Parent
regen = script.Parent.Parent
save = regen:clone()

function onClicked(player)
    if player:GetRankInGroup(groupIdHere) >= 5 then
        regen:remove()
        back = save:clone()
        back.Parent = location
        back:MakeJoints()
    end
end 

script.Parent.ClickDetector.MouseClick:connect(onClicked)

Something like this if I am correct, and no problemo.

2 Likes

Man, Thank You so much!! You really helped me out!

1 Like