So I have started working on a new wizardy type game. Each person gets a wand and when they say a spell and click somewhere, it fires there. But what I am having trouble with is making the object fire where the person clicks. I already have got it to spawn on the tip of the wand when they click, I just don't know how to make it shoot where they are clicking and to going in the direction they are looking, Anything helps!
Here is what I have so far:
game.ReplicatedStorage.ray.OnServerEvent:Connect(function(player, name, a, b, c) local animation = game.Players:FindFirstChild(name).Character.Humanoid:LoadAnimation(game.Workspace:FindFirstChild(name).Wand.Animation) animation:Play() local x = a local y = b local z = c local ray = game.Lighting.ray:Clone() ray.Parent = workspace wait(.1) ray.PrimaryPart.Position = game.Workspace:FindFirstChild(name).Wand.Tip.Position end)