I have a union that I clone in a function that I want to go infinitey in the x or y positions based on where they clicked, but how do I make it not fall do to gravity?
fireWizardCallXOutFunction.OnServerEvent:connect(function(player,mouseHit)
local lmbWaitTimeLeft = player.Backpack.PlayerData.InGameData.Cooldowns.LMBCooldown.Value
local lmbWaitTime = game.ReplicatedStorage.Info.Characters.FireWizard.LMBAttack.Attack2Cooldown.Value
local torso = player.Character.HumanoidRootPart
local xout = game.ServerStorage.XOut
local xoutCopy = xout:Clone()
xoutCopy.Parent = game.Workspace
xoutCopy.Position = torso.Position
xoutCopy.CFrame = player.Character:WaitForChild("HumanoidRootPart").CFrame
xoutCopy.Velocity = mouseHit * 25
player.Backpack.PlayerData.InGameData.Cooldowns.LMBCooldown.Value = lmbWaitTime
end)
Local Script Function:
local mouse = player:GetMouse();
mouse.Button1Down:connect(function()
local lmbWaitTimeLeft = game.Players.LocalPlayer:WaitForChild("Backpack").PlayerData.InGameData.Cooldowns.LMBCooldown.Value
if lmbWaitTimeLeft == 0 and not xoutAttackCalled then
xoutAttackCalled = true
local mouseHit = mouse.Hit.lookVector
local animation = game.Workspace.Animations.FireWizard.xoutAttackAnimation
local trackAnimation = nil
trackAnimation = player.Character.Humanoid:LoadAnimation(animation)
player.Character.Humanoid.WalkSpeed = 0
player.Character.Humanoid.JumpPower = 0
trackAnimation:Play()
wait(2)
fireWizardCallXOutFunction:FireServer(mouseHit)
player.Character.Humanoid.WalkSpeed = 16
player.Character.Humanoid.JumpPower = 50
xoutAttackCalled = false
end
end)

16 comments
Enable Can Collide
You can't get the Mouse's Hit from the server only client.
its passed in from a local script
But you're defining it in a server. The client has a mouse but the server doesn't. The client handles user input and not the server.
Its getting it fine, ill edit the post with the localscript function. The mousehit isn't the problem here....
The server doesn't handle user input and the mouse is user input! Why would you have the mouse's Hit in the server anyways!
I get the user input from the local script and then pass in the numbers to the server. That is how parameters for a function work bud. I use the mouse hit to send the object in the direction that the mouse was when the button was click. If you read the code you wuold find that out. The fact you don't get function parameters means you don't have the qualifications to comment on this matter.
PLUS if it DIDNT work then how come when I put a print(mouseHit) on the server side script it prints out the numbers of the mouse's position?
again the server doesn't have the mouse. the client does. you're saying if a player moves their mouse one way all the clients mice will too? again you should learn about User input mainly ContextActionService and UserInputService :) noob
But why have the server handle the mouse movement. You have to #1 tell the server you moved the mouse and #2 the server has to tell the clients to do blah blah blah and just a lot of lag and if you just handled the mouse in the localscript and only locally it would completely eliminate lag time. logic
DUDE the server doesn't have the mouse, the mouseHit is a vector3 that is no longer connected to the mouse. All it is is a vector3 that I named mouseHit. It isn't the mouse itself NOOB
I cannot create the part in the local script because the part would only show up for the one client, so I pass in the lookvector of the mouse so it renders 1 part going in the direction of the player that casted the attack
AND ONCE AGAIN this is not the point of the question... if you can tell me how to make a moving object not fall because of gravity you would finally be helpful to the conversation
mouse.Hit is a CFrame value, LOL
Thats besides the point that you're wrong on the issue
can't believe you're from 2012 and me from 2014 i know more. seems pged kid