This works in studio, but doesn't in play/server mode. I have tried using normal script AND local script, and no result. How can you get it to work?

Here is the script

repeat wait() until game.Players.LocalPlayer.Character


local plr = game.Players.LocalPlayer
local MyBody = plr.Character
local mouse = plr:GetMouse()
local flash = script.Light
local spark = script.Sparkles

script.Parent.Activated:connect(function()
	local hit = CFrame.new(Vector3.new(-720.8, 20, 35.2))
	script.Use:play()
	spark:Clone()
	spark.Parent = MyBody.Torso
	flash:Clone()
	flash.Parent = MyBody.Torso
	wait(0.2)
	MyBody:MoveTo(hit.p)
	MyBody.Torso.Light:remove()
	MyBody.Torso.Sparkles:remove()
end)

2 comments

0

Of course the normal script wouldn't work because normal scripts can't get your mouse position or local player. You'll have to have a local script that sends the information to a normal script.

0

Use remote events to send the information that the local script gets to a server script