Here's the script,the problem is in the last few rows.

wait()
local event = script.Parent


event.OnServerEvent:Connect(function(player, Hit)
	
	
	local anim = player.Character.Humanoid:LoadAnimation(script.Charge)
	
	anim:Play()

local darknebula = Instance.new("Part")
darknebula.Shape = "Ball"
darknebula.Parent = player.Character.RightHand
darknebula.Size = Vector3.new(35, 35, 35)
darknebula.Color = Color3.fromRGB(0, 0, 0)
darknebula.Material = "Neon"
darknebula.Name = "darknebula"
darknebula.Massless = true
darknebula.CanCollide = false

local weld = Instance.new("Weld")
weld.Name = "Weld"
weld.Parent = darknebula
weld.Part1 = darknebula
weld.Part0 = player.Character.RightHand
weld.C0 = CFrame.new(0, 0, 0)
weld.C1 = CFrame.new(0, 35, 0)



local bg = Instance.new("BodyGyro",player.Character.UpperTorso)
bg.Name = "skillgyro"
bg.D = 100
bg.MaxTorque = Vector3.new(math.huge, math.huge, math.huge)

local bp = Instance.new("BodyPosition",player.Character.UpperTorso)
bp.Name = "skillposition"
bp.Position = player.Character.HumanoidRootPart.Position
bp.MaxForce = Vector3.new(math.huge, math.huge, math.huge)


local Pos = Hit.p
bg.CFrame = CFrame.new(player.Character.UpperTorso.CFrame.p,Pos)

Here's the local script:

local players = game:GetService("Players")
local player = players.LocalPlayer
local char = player.Character
local humanoid = char:WaitForChild("Humanoid")
Enabled = true
local mouse = player:GetMouse()

local UIS = game:GetService("UserInputService")

UIS.InputBegan:Connect(function(key,isTyping) -- The key parameter gets filled with whatever key is pressed, and isTyping, or the second parameter is whether or not the player currently has the chat open.
if Enabled == false then return end
    if key.KeyCode == Enum.KeyCode.Q and isTyping == false then
        -- Script for when key is pressed here.
local Hit = mouse.Hit
		workspace.Events.DemonAbilities["Dark Nebula"]:FireServer(Hit)
		

    end

end)

UIS.InputEnded:Connect(function(key,isTyping)
if Enabled == false then return end
    if key.KeyCode == Enum.KeyCode.Q and isTyping == false then -- Don't mind all the weird stuff with enum and crap, and just put the key you want after KeyCode.
        -- When key is let go of script here.

		workspace.Events.DemonAbilities.darknebulaweldoff:FireServer()
       Enabled = false
    end

	wait(15)
	Enabled = true
	
end)

25 comments

0

Yeah, give us 44 lines of unindented code only to tell us lt's "in the last few rows". What is the "last few rows" to you?

0

I'm finding your question a bit hard to understand, could you rephrase?

0

The last few rows are like from 32 to 44 also it's pretty hard to fit a whole question in only 100 words

0

Brother, what. Is. Your. Problem? answer that question for me, the FIRST out of all you've actually given insetad of undermining everyone like an a hole.

0

When i press the hotkey that activates this server script the character rotates towards the mouse and then stops, i need the character to be able to keep rotating when u move the mouse around.

0

Judging by the FE syntaxing above, there is another Script, could we see that?

0

this Rotating is an animation? they rotate (walk) to the Vector3 position of the mouse?

0

You should be able to see the local script now

0

then Stop rotating?

0

The character is supposed to get frozen in place and always face the mouse cursor, but what happens instead is he only faces the mouse cursor in the moment of activation and then stays frozen.

0

It's meant to be aiming a skill

0

It would be better if you removed the Players variable and just used the same index with.LocalPlayer at the end, also do workspace:FindFirstChild(Player.Name) for finding the Character, although your method works too

0

also just saying mouse.Hit.p instead

0

no need for a shortcut, I'm just giving you efficiency tips, what exactly are you indexing when firing the Server though

0

Have you tried .LookVector?

0

I am transfering the mouse cframe to the server script

0

Gonna try it now

0

Dont index the character from the workspace. You are being taught bad ways. Use the character property always

0

Someone told me that i should keep the mouse position updated, how can i do that in this situation?

0

Dont store it in a variable

0

Or do it client sided because a client has network ownership over their character

0

What exactly do u mean by that

0

You can move the player on the client side

0

You are right, how could i be so stupid

0

This question is a mess