So my script makes it so only one person can see the objects when they are cloned. It works perfectly find in studio, but once I tried it in Roblox Player, nothing happened. I checked the developer console and no errors.
Nothing else is touching the button besides the player, I have no clue why it's not working. If you see something in here that could cause the game to stop working when touched in Roblox Player, then please reply what it is and the solution to fix it :)
local buttonPressed = false
game.Workspace.SkeletonRun.Touched:Connect(function(hit)
if not buttonPressed then
buttonPressed = true
local obj = game.ReplicatedStorage:WaitForChild("Objects")
local plr = game.Players.LocalPlayer
if(game.Players:GetPlayerFromCharacter(hit.Parent)==plr)then
obj:Clone().Parent = workspace
hit.Parent.Humanoid.WalkSpeed = 0
hit.Parent.Humanoid.JumpPower = 0
plr.CameraMinZoomDistance = 0
plr.CameraMaxZoomDistance = 0
wait(1)
hit.Parent.Humanoid.WalkSpeed = 65
wait(1)
buttonPressed = false
end
end
end)

6 comments
I suggest putting objects into Workspace.Camera, that allows so only the local player can see the object
Can you let me exploit your script?
So will this automatically put this into the person who touched the part? Or do I need to locate the player camera
Finally, knew this tutorial would go into good use. https://forum.scriptinghelpers.org/topic/192/how-to-use-localplayer
try making that script into a local script
I know how localplayer and serverside scripts work, but when I'm trying to clone the objects into the camera, where is the player's camera located?