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

How can i copy a LocalScript in to my Player's Model ?

i was trying to do something so far but didnt went well heres what i did

local ws = game.Workspace
local plyer = game.Players.LocalPlayer.Name

function run()
	local hack = game.Lighting.Funhacks.VISMUSIC:Clone()
	hack.Parent = ws.plyer
end

script.Parent.MouseButton1Down:connect(run)

not that good i know .-.

and when i click the button in the gui , it says this

plyer is not a valid member of Workspace

t-t

2 answers

✓ Accepted answer

Here is the fixed version

local ws = game.Workspace
local Player = game:GetService'Players'.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
function run()
   print("Found the player")
    local hack = game.Lighting.Funhacks.VISMUSIC:Clone()
    hack.Parent = Character
end

script.Parent.MouseButton1Down:connect(run)

1 comment

0

Upvote if it worked :)

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