Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Passing variables on FE local script to script through FireServer won't work?

I want to pass the mouse variable from the script to the local script so I can use it in the script it works fine in studio, it will say that the mouse variable is = nil in the dev logs ingame. the problem is in the script line 13

LocalScript:

local Player = game.Players.LocalPlayer
repeat wait() until Player.Character
Character = Player.Character
Mouse = Player:GetMouse()
local Tool = script.Parent 
local en = true
Tool.Activated:connect(function()
if en == true then
en = false
if script.Parent.Script2.Value.Value == true then return end
local anim = Instance.new("Animation")
anim.AnimationId = "http://www.roblox.com/asset/?id=1777434091" -- id of animation
		local humanoid = Character.Humanoid
		local Animation = humanoid:LoadAnimation(anim)
		Animation:Play()
print("hi")
if Mouse ~= nil then
Tool.RemoteEvent:FireServer(Mouse)
end
enabled = true
Mouse.Button1Up:connect(function()
if Character.Torso:FindFirstChild("BallFire")then
if enabled == true then
	enabled = false
Tool.RemoveEvent2:FireServer(Mouse)
script.Parent.Name = "Dragon's Beam [5]"
wait(1)
script.Parent.Name = "Dragon's Beam [4]"
wait(1)
script.Parent.Name = "Dragon's Beam [3]"
wait(1)
script.Parent.Name = "Dragon's Beam [2]"
wait(1)
script.Parent.Name = "Dragon's Beam [1]"
wait(1)
script.Parent.Name = "Dragon's Beam"
script.Parent.Script2.Value.Value = false
print("back")
script.Parent.Parent = Player.Player_Data
		wait()
		script.Parent.Parent = Player.Backpack
		wait()
		enabled = true
		end
en = true
end
end)
end
end)

Script:

Player = script.Parent.Parent.Parent
repeat wait() until Player.Character
Character = Player.Character
Tool = script.Parent
en = true
Tool.RemoteEvent.OnServerEvent:connect(function(player,Mouse)
	if en == true then
		en = false
	print("Activated")
Character.Humanoid.WalkSpeed = 0
Character.Humanoid.JumpPower = 0
	 local Torso = Character.Torso
	    local direction = (Mouse.Hit.p - Torso.Position) * Vector3.new(1, 0, 1) -- problem here
    Torso.CFrame = CFrame.new(Torso.Position, Torso.Position + direction)
local anim = Instance.new("Animation")
anim.AnimationId = "http://www.roblox.com/asset/?id=1777434091" -- id of animation
		local humanoid = Character.Humanoid
		_G.Animation = humanoid:LoadAnimation(anim)
		_G.Animation:Play()
		_G.Animation:AdjustSpeed(1.2)
		wait(0.75)
		 local BallFire = Instance.new("Part")
		BallFire.Name = "BallFire"
		BallFire.Shape = "Ball"
		BallFire.Size = Vector3.new(0.25,0.25,0.25)
		BallFire.Material = "Neon"
		BallFire.BrickColor = BrickColor.new("Neon orange")
		BallFire.Parent = Character.Torso
		BallFire.CFrame = Character.Head.CFrame * CFrame.new(0,-0.25,-2)
		BallFire.Anchored = true
		BallFire.CanCollide = false
		_G.Animation:AdjustSpeed(0)
		for i = 1,10 do
		BallFire.Size = BallFire.Size + Vector3.new(0.175,0.175,0.175)
		wait()
		end
local Torso = Character.Torso
local Breath = Instance.new("Part")
Sound = script.Sound:Clone()
Sound.Parent  = BallFire
Sound.Playing = true
Breath.Name = "Breath"
Breath.Shape = "Ball"
Breath.Size = Vector3.new(6.05, 6.05, 6.05)
Breath.CanCollide = false
Breath.Transparency = 1
local Particle = game.ServerScriptService.Particle:Clone()
local Particle2 = game.ServerScriptService.WeldToBall:Clone()
Particle2.Parent = BallFire
Particle2.CFrame = BallFire.CFrame
local W3 = Instance.new("Weld")
W3.Part0 = BallFire
W3.C0 = BallFire.CFrame:inverse()
W3.Part1 = Particle2
W3.C1 = Particle2.CFrame:inverse()
W3.Parent = Particle2
Particle.Parent = Breath
Breath.Parent = Torso
Breath.CFrame = Torso.CFrame
wait()
Particle2.CFrame = BallFire.CFrame
local W3 = Instance.new("Weld")
W3.Part0 = BallFire
W3.C0 = BallFire.CFrame:inverse()
W3.Part1 = Particle2
W3.C1 = Particle2.CFrame:inverse()
W3.Parent = Particle2
local W = Instance.new("Weld")
W.Part0 = Breath
W.C0 = Breath.CFrame:inverse()
W.Part1 = Torso
W.C1 = Torso.CFrame:inverse()
W.Parent = Torso
BallFire.BrickColor = BrickColor.new("Bright orange")
wait(0.25)
BallFire.Anchored = false
local W4 = Instance.new("Weld")
W4.Part0 = Character.Head
W4.C0 = Character.Head.CFrame:inverse()
W4.Part1 = BallFire
W4.C1 = BallFire.CFrame:inverse()
W4.Parent = BallFire
Particle.Parent = Breath
Breath.Parent = Torso
Breath.CFrame = Torso.CFrame
	end
end)

1 answer

✓ Accepted answer

Mouse is a local object. You cannot pass it to the server. You can pass the location it points at though.

This discussion is preserved as it was. New answers, comments, and votes are closed.