How to active localscript in character model?

I want to change players’ character and make them use some skills but idk how
Is there any way to do this?

4 Likes

crazy… please do what the other guy said

2 Likes

You can put this code in a local script under StarterPlayerScripts (putting it under startercharacterscripts as mentioned above is a bad practice you should avoid) and put your code in the characterAdded function:

local players = game:GetService("Players")
local player = players.LocalPlayer


local function characterAdded(character: Model)
--Code
end

player.CharacterAdded:Connect(characterAdded)
3 Likes

No

Summary

Abcdefghijklmnopqrstuvwxyz

3 Likes

I’d recommend

local players = game:GetService("Players")
local player = players.LocalPlayer


local function characterAdded(character: Model)
--Code
end

player.CharacterAdded:Connect(characterAdded)

if player.Character then characterAdded(player.Character) end

because, you know, unexpected things happen.

3 Likes

I fixed the problem. Thank you so much

1 Like

No problem, always happy to help

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.