Hey! I currently need some help with an undertale-related script that lets you spawn blasters that aim at the players mouse, but somehow the blasters can’t rotate at the mouses current position, help!
Heres some sample of the two scripts.
wait(0.1)
local uis = game:GetService("UserInputService")
local pl = game.Players.LocalPlayer
local mouse = pl:GetMouse()
local char = pl.Character
script.Asset.Initialize:FireServer(char)
uis.InputBegan:connect(function(input,gpe)
if not gpe then
if input.KeyCode == Enum.KeyCode.E then
script.Attack:FireServer(1,mouse.Hit)
end
end
end)```
``` lua
script.Parent.Attack.OnServerEvent:Connect(function(plr, mode, mouseHit)
if mode == 1 and coolingdown == false then
local flame = plr.Character:FindFirstChild("HandFlame")
flame.Flame.Enabled = true
coolingdown = true
local gbc = game.ReplicatedStorage:WaitForChild("Gaster Blaster"):Clone()
gbc.Parent = game.Workspace
gbc.Summon:Play()
gbc.BodyGyro.CFrame = CFrame.new(plr.Character.HumanoidRootPart.Orientation, Vector3.new(0, mouseHit.Position.Y-90, 0))
gbc.BodyPosition.Position = Vector3.new(plr.Character.Head.Position.X,plr.Character.Head.Position.Y+5,plr.Character.Head.Position.Z)
local anim = plr.Character.Humanoid:LoadAnimation(script.Parent.Asset.Anims.Send)
anim:Play()
wait(1)
flame.Flame:Emit(90)
gbc.Fire:Play()
flame.Flame.Enabled = false
coolingdown = false
end
end)
Heres a video showing the problem as well.