local part = script.Parent game.Players.PlayerAdded:connect(function(plr) part.Touched:connect(function(hit) if hit.Name == "auto" .. plr.Name then if game.Lighting.SecretsFolder:FindFirstChild("shrek") then local shrek = game.Lighting.SecretsFolder.shrek shrek.Parent = game.Workspace shrek.Position = part.Position - Vector3.new(3.4, 0, 0) else local p = game.Lighting.SecretsFolder.poo:Clone() p.Parent = game.Workspace p.Position = part.Position + Vector3.new(3.4, 0, 0) end end end) end)
This works on studio, but no in-game? Why? Thanks for help!
I'm not sure why is there hit.Name == "auto"..plr.Name. I assume you wanted make part.Name == "auto".. plr.Name.
local part = script.Parent game.Players.PlayerAdded:connect(function(plr) part.Touched:connect(function(hit) if part.Name == "auto" .. plr.Name and game.Players:FindFirstChild(plr.Name) ~= nil then --check if player Exist. Seems like name of script.Parent is adjusted by script. If you name it 'autoPlayer1' in studio and did not rename it to 'autohappyturk4' when you played the game. It could not have worked because it's name was autoPlayer1 not autohappyturk4. However I might be wrong. This script works if script.Parent name would be autohappyturk4 if game.Lighting.SecretsFolder:FindFirstChild("shrek") then local shrek = game.Lighting.SecretsFolder.shrek shrek.Parent = game.Workspace shrek.Position = part.Position - Vector3.new(3.4, 0, 0) else local p = game.Lighting.SecretsFolder.poo:Clone() p.Parent = game.Workspace p.Position = part.Position + Vector3.new(3.4, 0, 0) end end end) end)