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

smoke on vip's body, script not working?

Asked by
DanzLua 2879 Moderation Voter Community Moderator
9 years ago

Hi, i'm trying to use a script to give player's with a certain gamepass smoke on there torso. i am currently using this script.

local GamePassService = Game:GetService('GamePassService')
local GamePassIdObject = WaitForChild(script, 'GamePassId')

local function OnCharacterAdded(char)
    local smoke = Instance.new("Smoke", char:WaitForChild("Torso"))
    smoke.Color = Color3.new(1, 0, 0) -- red, remember to use 0-1 and not 0-255. If you want to use 0-255, just make sure to divide each number by 255.
    smoke.Size = 5
end

local function OnPlayerAdded(player)
    if GamePassService:PlayerHasPass(player, GamePassIdObject.Value) then
        player.CharacterAdded:connect(OnCharacterAdded)
    end
end

Game:GetService("Players").PlayerAdded:connect(OnPlayerAdded)

the problem is when i run this it doesn't work, here's the output

01:06:12.470 - Workspace.vip smoke:2: attempt to call global 'WaitForChild' (a nil value) 01:06:12.471 - Stack Begin 01:06:12.472 - Script 'Workspace.vip smoke', Line 2 01:06:12.472 - Stack End

Thanks.

Answer this question