local config = script.Configuration game.Workspace.Part.Touched:Connect(function(player) if player:GetPlayerFromCharacter() then if player:GetRankInGroup(config.GroupId) >= config.Rank then game.Workspace.Part:Destroy() end end end)
How might I make this script think the parameter as a player? (The script is inside the StarterCharacterScripts, if this may help.)
You are using the** touched** event and **GetPlayerFromCharacter() **incorrectly.
The Touched event doesn't pass a player it passes the part that touched that part
GetPlayerFromCharacter() -- Requires a potential character in it's paramaters
.Touched:Connect(function(hit) -- Hit is the part that touched the part your listening for touch local potentialPlayer = game.Players:GetPlayerFromCharacter(hit.Parent) if potentialPlayer then -- Must be a player since it returned true -- Then search for their rank etc end end)
Also if this is meant to be client sided then it's completely pointless to even bother getting the player from the touched event.
If this helps an upvote or solve would be greatly appreciated.
game.Players.PlayerAdded:Connect(function(player) game.Workspace.Part.Touched:Connect(function() if player then if player:GetRankInGroup(886313) >= 1 then game.Workspace.Part:Destroy() end end end) end)