Basically, I'm trying to create a rank exclusive door. When the character touches the door, I want the property can collide to be false if they are a certain rank. It doesn't work, I know I'm doing something horribly wrong.
This is the error: GetRankInGroup is not a valid member of Part
(I feel annoyed with myself that I have to keep on asking questions on this site because of my poor script knowledge, I'm sorry but I don't want to use scripts online)
Script: Regular Script
function rank(player, hit) if player:GetRankInGroup(4266272) == 0 then script.Parent.CanCollide = true else script.Parent.CanCollide = false end end script.Parent.Touched:connect(rank)
And if someone could properly explain services, get services and things like that (simply) that'd be great! I'm still learning about that, and no wiki site can explain it clearly enough for me.
In your script you needed to get player from Touched use function :GetPlayerFromCharacter(examplefunction.Parent)
Example:
local PartTouch = script.Parent local GroupID = 0 local RankID = 0 PartTouch.Touched:connect(function(plrhit) if plrhit.Parent:FindFirstChild("Humanoid") then local Player = game:GetService("Players"):GetPlayerFromCharacter(plrhit.Parent) if Player:GetRankInGroup(GroupID) >= RankID then PartTouch.CanCollide = false wait(1.5) PartTouch.CanCollide = true else PartTouch.CanCollide = true end end end)
Also. CanCollide = true enables collision. use false
game.Players:GetPlayerByCharacter(player) at the start of the function