local Rep = game:GetService(“ReplicatedStorage”)
local Remote = Rep:WaitForChild(“Meteor”)
Remote.OnServerEvent:Connect(function(plr,Mouse)
local Char = plr.Character
local Hrp = Char:WaitForChild("HumanoidRootPart")
local Hum = Char:WaitForChild("Humanoid")
local X = math.random(-35,35)
local Y = math.random(50,100)
local Z = math.random(-45,45)
local function Fire()
local Meteor = script:WaitForChild("OldMeteor"):Clone()
Meteor.CFrame = Hrp.CFrame * CFrame.new(math.random(-200,200),math.random(50,100),math.random(-200,200))
Meteor.Anchored = false
Meteor.CanCollide = false
Meteor.Parent = workspace
local bv = Instance.new("BodyVelocity",Meteor)
bv.MaxForce = Vector3.new(1,1,1) * math.huge
bv.Velocity = Mouse.LookVector * 180
print(Meteor.CFrame)
end
Fire()
end)
1 Like
EDIT: the spawn position is set by
Meteor.CFrame = Hrp.CFrame * CFrame.new(math.random(-200,200),math.random(50,100),math.random(-200,200))
It spawns it at where i put it when its in replicated storage and not at the random position
move it into workspace before you change the cframe.
local Meteor = script:WaitForChild("OldMeteor"):Clone()
Meteor.Parent = game.Workspace
Meteor.CFrame = Hrp.CFrame * CFrame.new(math.random(-200,200),math.random(50,100),math.random(-200,200))
Meteor.Anchored = true
Meteor.CanCollide = false
ive worked on way harder code and the fact that i could fix thing bug to find out this easy fix thank you
oh nevermind it seem to not work
works find for me
code:
Hrp = lPlayer.Character:FindFirstChild("HumanoidRootPart");
for i = 0, 300, 1 do
local Meteor = Instance.new("Part")
Meteor.Color = Color3.new(1,30/255,100/255);
Meteor.Parent = game.Workspace
Meteor.CFrame = Hrp.CFrame * CFrame.new(math.random(-200,200),math.random(50,100),math.random(-200,200))
Meteor.Anchored = false
Meteor.CanCollide = false
task.wait(0.1);
end
You can aim mine with a mouse, the problem is that it spawn a the same location