Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How come the last part of my code doesn't work?

  local platform = Instance.new("Part")
platform.Parent = game.Workspace.CurrentCamera
platform.CFrame = CFrame.new(12.5, 1.71, 17.43)
platform.Anchored = true
platform.Transparency = .5
platform.Size = Vector3.new(5, 10, 1)
local Players = game:GetService("Players")
 
function onPlayerAdded(player)
	if  (player.Name:GetRankInGroup(2551575) >= 239) then	
		platform.CanCollide = false
	end
end
Players.PlayerAdded:connect(onPlayerAdded)

2 comments

0

You have not connected the function to the event?

0

WHat you mean

1 answer

The Player function :GetRankInGroup() is a function of the player object, not the name of the player. On line 12, you were trying to use it on the player's name, not the player themselves.

Thus, it can be changed to this:

local Players = game:GetService("Players")
local platform = Instance.new("Part")
platform.CFrame = CFrame.new(12.5, 1.71, 17.43)
platform.Anchored = true
platform.Transparency = .5
platform.Size = Vector3.new(5, 10, 1)
platform.Parent = workspace.CurrentCamera

function onPlayerAdded(player)
    if  (player:GetRankInGroup(2551575) >= 239) then   
        platform.CanCollide = false
    end
end
Players.PlayerAdded:connect(onPlayerAdded)

1 comment

0

Still doesnt work

This discussion is preserved as it was. New answers, comments, and votes are closed.