ok so I'm trying to have a command that when you send it, it inserts a script into everyone
01 | game.Players.PlayerAdded:Connect( function (player) |
02 | player.CharacterAdded:Connect( function (char) |
03 | player.Chatted:Connect( function (msg) |
04 | if string.sub(msg, 0 , 1 ) = = "/" then |
05 | if string.sub(msg, 2 ) = = "command" then |
06 | for i, plr in pairs (game.Players:GetPlayers()) do |
07 | if char:FindFirstChild( "TrollScript" ) then |
08 | print ( "already in action" ) |
09 | else |
10 | game.ServerStorage.TrollScript:Clone(char).Name = "TrollScript" |
11 | print ( "Added Script" ) |
12 | end |
13 | end |
14 | end |
15 | end |
16 | end ) |
17 | end ) |
18 | end ) |
the issue I have is that it prints that it added the script, but if I look inside my character, there's no local script that I'm inserting.
if anyone knows what's wrong, please reply the help would be appreciated.
Clone() is a blank method that returns a clone of the Instance it was called from. It doesn't have any parameters.
You never gave the clone a Parent, so it just sits in thin air.
What I noticed is by you doing this...
1 | Clone(char) |
...you're telling the method to accept char
as an argument to...what parameter exactly? Clone() doesn't have any parameters to fill when you call it.
ok so I know what went wrong, it was in fact that there's not an argument for :Clone, when I originally was testing with cloning, I was on a world with beta features on, so it works now.