#How do i fix this stutter?
1 messages · Page 1 of 1 (latest)
** You are now Level 3! **
local tool = script.Parent
local remoteEvent = tool:WaitForChild("RemoteEvent")
local meshTemp = game.ReplicatedStorage.Templates.GrenadeMesh
local THROW_POWER = 75
local UPWARD_FORCE = 50
remoteEvent.OnServerEvent:Connect(function(plr)
local char = plr.Character
if not char or not char:FindFirstChild("HumanoidRootPart") then return end
local root = char.HumanoidRootPart
local clone = meshTemp:Clone()
clone.Parent = workspace
clone.CFrame = root.CFrame * CFrame.new(0, 0, -3)
local launchVelocity = (root.CFrame.LookVector * THROW_POWER) + Vector3.new(0, UPWARD_FORCE, 0)
clone.AssemblyLinearVelocity = launchVelocity
end)
(the server script)
local remoteEvent = script.Parent:WaitForChild("RemoteEvent")
local tool = script.Parent
tool.Activated:Connect(function()
remoteEvent:FireServer()
end)
(local)
try
uh
it has to do with network ownership
thats why the delay
https://devforum.roblox.com/t/how-to-make-insanely-smooth-grenades/3310011 try looking at this
I’ve been trying to make a grenade-like tool but for some reason, the ones in phantom forces are super accurate and insanely smooth to throw, but whenever i try to make one there will be a slight delay and the throw isn’t super great either. –Example Video Video (2).wmv (2.2 MB)
** You are now Level 15! **
ive looked it up and i dont get it how it works
yes
now
when you fire a remote
you make the grenade without waiting for the server
make the grenade on client and throw it right
then the server verifies it etc etc and send a remote to all the other clients
then they make a grenade on their own game
so first in local script you fire remote then make the throw in the same local
yep
you assume the server will accept the grenade
otherwise you will get annoying delays
after you catch the event on server script you do the checks and send a remote to all clients
yes
and you use onclient event on the local script?
yeah
and make the grenade on onclient event
but the client throwing it
doesnt do that
the client throwing it fires the remote and makes the grenade* in the same function
because if you wait for the server there will be a delay and itwont be smooth
i will send you the scripts after i try okay?
ok
local tool = script.Parent
local remoteEvent = tool:WaitForChild("RemoteEvent")
local meshTemp = game.ReplicatedStorage.Templates.GrenadeMesh
local THROW_POWER = 75
local UPWARD_FORCE = 50
local plr = game.Players.LocalPlayer
tool.Activated:Connect(function()
remoteEvent:FireServer()
remoteEvent.OnClientEvent:Connect(function()
local char = plr.Character
if not char or not char:FindFirstChild("HumanoidRootPart") then return end
local root = char.HumanoidRootPart
local clone = meshTemp:Clone()
clone.Parent = workspace
clone.CFrame = root.CFrame * CFrame.new(0, 0, -3)
local launchVelocity = (root.CFrame.LookVector * THROW_POWER) + Vector3.new(0, UPWARD_FORCE, 0)
clone.AssemblyLinearVelocity = launchVelocity
end)
end)
(local)
local tool = script.Parent
local remoteEvent = tool:WaitForChild("RemoteEvent")
local meshTemp = game.ReplicatedStorage.Templates.GrenadeMesh
local THROW_POWER = 75
local UPWARD_FORCE = 50
remoteEvent.OnServerEvent:Connect(function(plr)
remoteEvent:FireAllClients()
end)
(server script) i think i ddint do it right
@unkempt fox
does the grenade go smoothly in ur client
on the server u need to send needed data to other clients
it does but it spawns hella lot of grenades at once
because
ur connecting inside the activated function
ur connecting a new remote event every time u click
so it multiplies
so i should separate the remotes?
put this outside activated
thankss,but i got a problem that it only shows to one of the clients
because u need to send the needed grenade data to other clients
so i should put something is here?
what should i send to the clients?
ive got nothing to send
sorry for being intrusive @unkempt fox
but i need it to work
local tool = script.Parent
local remoteEvent = tool:WaitForChild("RemoteEvent")
local meshTemp = game.ReplicatedStorage.Templates.GrenadeMesh
local THROW_POWER = 75
local UPWARD_FORCE = 50
remoteEvent.OnServerEvent:Connect(function(plr, spawnPos, throwPower, upwardForce)
remoteEvent:FireAllClients(plr, spawnPos, throwPower, upwardForce)
end)
The server script
local tool = script.Parent
local remoteEvent = tool:WaitForChild("RemoteEvent")
local meshTemp = game.ReplicatedStorage.Templates.GrenadeMesh
local THROW_POWER = 75
local UPWARD_FORCE = 50
local plr = game.Players.LocalPlayer
tool.Activated:Connect(function()
remoteEvent:FireServer(plr.Character.HumanoidRootPart.Position, THROW_POWER, UPWARD_FORCE)
end)
remoteEvent.OnClientEvent:Connect(function(plr, spawnPos, throwPower, upwardForce)
if (plr == game.Players.LocalPlayer) then return end
local char = plr.Character
if not char or not char:FindFirstChild("HumanoidRootPart") then return end
local root = char.HumanoidRootPart
local clone = meshTemp:Clone()
clone.Parent = workspace
clone.CFrame = spawnPos.CFrame * CFrame.new(0, 0, -3)
local launchVelocity = (spawnPos.CFrame.LookVector * throwPower) + Vector3.new(0, upwardForce, 0)
clone.AssemblyLinearVelocity = launchVelocity
end)
the local script.Honestly i doesnt even know what im doing and everything stopped working and i think i should just leave it with this stutter rather than trying to figure it out
@unkempt fox
well u can do that
but i suggest learning about
how remotes work
and server client relation
i've learnt but i think i just cant get it to work
ye i want to help but im busy rn
** You are now Level 4! **