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

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

Asked by 7 years ago
Edited 7 years ago

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

Log in to vote
0
Answered by 7 years ago

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)
0
Upvote if it worked :) KinqAustinn 293 — 7y
Ad
Log in to vote
0
Answered by 7 years ago

Thanks a lot! :D

0
No problem! :) KinqAustinn 293 — 7y

Answer this question