local script
Mouse.Button1Down:connect(function()
if frame.Minigunner.TroopImage.Enabled.Value == true then
if Mouse.Target:WaitForChild("Placeable").Value == true then
function MouseLock.OnClientInvoke()
return Mouse.Hit.Position
end
script.PartCreate:FireServer()
script.Detect.Value = true
game.Workspace.InvisibleMinigunner:remove()
end
end
end)
server script
local Character = script.Parent.Parent
local player = game.Players:GetPlayerFromCharacter(Character)
local folder = game.Workspace:FindFirstChild(Character.Name.."s Troops")
folder.Name = Character.Name.."s Troops"
wait(1)
local MouseLock = script.Parent:WaitForChild("Mouselock")
script.Parent.PartCreate.OnServerEvent:Connect(function()
if player.PlayerGui.Troops.TFrame.Minigunner.TroopImage.Enabled.Value == true then
player.PlayerGui.Troops.TFrame.Minigunner.TroopImage.Enabled.Value = false
script.Parent.Detect.Value = true
local GetPosition = MouseLock:InvokeClient(player)
local Troop = game.ReplicatedStorage.Towers:WaitForChild("Minigunner"):Clone()
local TIdle = script.Idle
Troop.Parent = folder
Troop.HumanoidRootPart.CFrame = CFrame.new(GetPosition + Vector3.new(0,1.29,0))
local TAnimation = Troop.Humanoid:LoadAnimation(TIdle)
TAnimation:Play()
Troop.Range.Anchored = true
Troop.HumanoidRootPart.Range:Remove()
end
end)
Is there a way to stop the delay in the server script? so basically when I click down, the local script does what it does, but if for example if I move my mouse right after clicking, the model will go to my mouse, when I want it to stay where I first clicked. Is there a way to stop this delay from happening?
Or is there another way to get the mouse position, because I've heard that you cant get rid of remote function delay
