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

Functions connected with events not working?

Ive been going back to the basics of scripting to help improve my self, but now, i cant seem to get a function thats connected with a event to work, everything else works but the Function Event? Am i doing something wrong or?




local part = game.Workspace.Dank
print(script.Name .. " Has been Activated" ) 
game.Players.PlayerAdded:Connect(function(plr)
    wait(1) 
    print(plr.Name .. " Has joined") 
    plr.CharacterAdded:Connect(function(char) 
        while true do 
            wait() 
              part.CFrame = CFrame.new(char.HumanoidRootPart.Position) 
        wait(1) 
        print("Updating Location") 

        end
        
    end)
end)
local function cool() 
    print(game.Players.LocalPlayer.Name .. " Has joined The Game") 
end
while true do 
    wait(2) 
    cool() 
end

2 comments

0

Is it a server script or local script? "game.Players.LocalPlayer" can't be used in a server script.

0

Its a local

1 answer

local part = game.Workspace.Dank
print(script.Name .. " Has been Activated" ) 
game.Players.PlayerAdded:Connect(function(plr)
    wait(1) 
    print(plr.Name .. " Has joined") 
    plr.CharacterAdded:Connect(function(char) 
        while true do 
	wait()
              part.Position = char.HumanoidRootPart.Position
	wait(1)
       	 print("Updating Location") 
        end

    end)
end)
local function cool() 
    print(game.Players.LocalPlayer.Name .. " Has joined The Game") 
end
while wait(2) do 
    cool() 
end

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