local repstore = game:WaitForChild("ReplicatedStorage") local Remote = repstore:WaitForChild("SmokeFlyStart")
Remote.OnServerEvent:Connect(function(player)
local char = player.Character
for i, v in pairs (char:GetChildren()) do if v.ClassName == "Part" or v.ClassName == "MeshPart" then v.Transparency = 1 end end local Smoke = game.Lighting.Smoke:Clone() Smoke.Parent = char.HumanoidRootPart local BV = Instance.new("BodyVelocity",char.HumanoidRootPart) BV.MaxForce = Vector3.new(math.huge,math.huge,math.huge) for i = 1,200 do wait() char.HumanoidRootPart.CFrame = CFrame.new(char.HumanoidRootPart.Position,***Mouse.Hit.p***) BV.Velocity = char.HumanoidRootPart.CFrame.lookVector*90 end for i, v in pairs (char:GetChildren()) do if v.ClassName == "Part" or v.ClassName == "MeshPart" then if v.Name ~= "HumanoidRootPart" then v.Transparency = 0 end end Smoke:Destroy() BV:Destroy() end
end)
I'm fairly new to scripting and this has been giving problem. Not sure if I'm suppose to create more variables. Is there a way to read the Mouse.Hit.p and transfer somehow?
u can t rly get mouse.Hit.p from a script; that has to be done locally(from a localscript) and transferred to a script. I recommend u get a localscript in all players and transfer the mouse.Hit.p via a remote event to the said script
what well do now is place a localscript in a script in the serverscriptservice to be cloned to all players
in script:
local item = script.LocalScript local re = Instance.new("RemoteEvent", game.ReplicatedStorage) re.Name = "mouse_event" game.Players.PlayerAdded:connect(function(player) local clone = item:Clone() clone.Parent = player:WaitForChild("Backpack") clone.Disabled = false wait(1) re:FireClient(player) end) re.OnServerEvent:connect(function(player, mpos) print(mpos) end)
in localscript:
local player = game.Players.LocalPlayer local mouse = player:GetMouse() local repstore = game.ReplicatedStorage local re = repstore:FindFirstChild("mouse_event") or repstore:WaitForChild("moues_event") re.OnClientEvent:connect(function() re:FireServer(mouse.Hit.p) end)
make sure the localscript is disabled; this will print out the player's mouse.Hit.p in approx. 1 second after a player has loaded in.