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

Why does this function script only work in Studio and not Player?

Asked by 6 years ago

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)

0
I suggest putting objects into Workspace.Camera, that allows so only the local player can see the object shootthegame 14 — 6y
0
Can you let me exploit your script? IMATROLLERHEREAHH -5 — 6y
0
So will this automatically put this into the person who touched the part? Or do I need to locate the player camera CardboardedCharacter 53 — 6y
0
Finally, knew this tutorial would go into good use. https://forum.scriptinghelpers.org/topic/192/how-to-use-localplayer hiimgoodpack 2009 — 6y
View all comments (2 more)
0
try making that script into a local script kevinliwu1 9 — 6y
0
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? CardboardedCharacter 53 — 6y

Answer this question