When I tried CloneTrooper1019's Murder game a while ago, one thing that was personally my favorite feature was when if you collect 5(?) gems(?) you would get a gun.
That was my favorite feature because it makes teaming and gun guarding pointless and the game more fun.
Now, I'm making a murder game using the Mad Bloxxer Template (from RBLX University), (since I only know the basics of scripting) and I really want to include that feature in the game.
But, as you know, I'm a noob at scripting, so that's why I need help on how it works. (Please explain step by step) Thank you for reading.
When I posted this at RBLX forums, someone replied with this, which I really didn't understand most of it.
game.Workspace.Gem.Touched:connect(function(hit)
if hit.Parent.ClassName == Character then else return end; -- checks if player if not returns nil
local name = hit.Parent.Name;
Players[name].GemValue = Players[name].GemValue + 1;
end)
-- in gem value
script.Parent.Changed:connect(function()
if script.Parent.Value == 5 then
script.Parent.Value = 0;
award_gun();
end
end)

2 comments
Thanks for the explanation, but how does the set up of the game effects this?
I don't know where Gem is at, the script claims it is in workspace. I don't know where the script is located, so I don't know what the script's parent is. I don't know how your game is set up, which affects where the script looks for things to interact with.