What do you want to achieve? Keep it simple and clear!
I wanted to try scripting a group rank depending spawn button.
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.
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!
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.
-- 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.