Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 7 years ago
Edited 7 years ago
  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)

0
You have not connected the function to the event? User#5423 17 — 7y
0
WHat you mean iSidersz 70 — 7y

1 answer

Log in to vote
0
Answered by
Uglypoe 557 Donator Moderation Voter
7 years ago

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)
0
Still doesnt work iSidersz 70 — 7y
Ad

Answer this question