Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Insta lazer projectile spawns in the middle of me?

Asked by 6 years ago
Edited 6 years ago

Please encode Lua code in the Lua block code tag (look for the Lua icon in the editor).

I've already made a "Lightning bolt" which is just a long cilinder part that I've Inserted into Replicated Storage Called "LightningBolt"

Inside the Starter GUI I put this script in a local script

01local ReplicatedStorage = game:GetService("ReplicatedStorage")
02local UserInputService = game:GetService("UserInputService")
03 
04local plr = game.Players.LocalPlayer
05local Char = plr.Character or plr.CharacterAdded:Wait()
06local Remote = ReplicatedStorage.LightningEvent
07local Mouse = plr:GetMouse()
08 
09local Debounce = true
10local Key = 'E'
11local Animation = Instance.new("Animation")
12Animation.AnimationId = 'rbxassetid://2464206362'
13 
14UserInputService.InputBegan:Connect(function(Input, IsTyping)
15if IsTyping then return end
View all 25 lines...

And in Server Script services I put this script

01local ReplicatedStorage = game:GetService("ReplicatedStorage")
02 
03 
04local Remote = ReplicatedStorage.LightningEvent
05local Lightning = ReplicatedStorage.LightningBolt
06 
07 
08local Damage = 10
09 
10local ServerDebounces = {}
11Remote.OnServerEvent:Connect(function(plr, Mouse)
12 if not ServerDebounces[plr] then
13  ServerDebounces[plr] = true
14 
15  local Char = plr.Character or plr.CharacterAdded:Wait()
View all 42 lines...

I know that there are still some things that are not needed and I can fix that latter, but I cant wrap my head around how to make the projectile that's pretty long start near me, and the other end where my curser is, this script just brings the middle of the "lazer" and places it infront of me, which isnt where I want it.

I honestly thought just taking away body-velocity and making a projectile script would work, but it seems Im not too bright

0
Format the other part of the code in a codeblock. xPolarium 1388 — 6y
0
I put it in the server script service Yonatann12 0 — 6y
0
Im going to assume though that I'd use raycasting to fix the issue  Yonatann12 0 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

Im dumb, I should just use raycasting

Ad

Answer this question