Ok so I came up with an idea of making a fighting game based on LocalScripts and I made it so that when you touch a giver, it will put the LocalScript in your PlayerScripts and It works in studio but not in the actual game ;p any solutions?
local debounce = false
function getPlayer(humanoid)
local players = game.Players:children()
for i = 1, #players do
if players[i].Character.Humanoid == humanoid then return players[i] end
end
return nil
end
function onTouch(part)
local human = part.Parent:findFirstChild("Humanoid")
if (human ~= nil) and debounce == false then
debounce = true
local player = getPlayer(human)
if (player == nil) then return end
script.Parent.BallistaSniper:Clone().Parent = player.PlayerScripts
wait(10)
debounce = false
end
end
script.Parent.Touched:connect(onTouch)

3 comments
Normal scripts can't access PlayerScripts or PlayerGui, so they can't clone things into them. Just drop the script in the player's backpack instead.
Wth how does it work when it's in the backpack? Thanks dude :D
Whenallthepigsfly, the server can access the PlayerGui, but not PlayerScripts.