So what im trying to do is make it so wherever i click with a tool a pokeball from my hand disapears and a new pokeball goes to where i clicked at
What i need help with is getting my click position and making the pokeball spawn at that position cause currently when i click is spawns in a specific location and i cant get it to spawn where i click
here are my scripts
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local PokeThrow = ReplicatedStorage:WaitForChild("PokeBallThrow")
local players = game:GetService("Players")
local player = players.LocalPlayer
local mouse = player:GetMouse()
local function TheFunction()
PokeThrow:FireServer(mouse.Hit.Position)
end
mouse.Button1Down:connect(TheFunction)
then it goes to this
local RS = game:GetService("ReplicatedStorage")
local PokeThrow = RS:WaitForChild("PokeBallThrow")
PokeThrow.OnServerEvent:connect(function(player, MousePosition)
local mouse = player:GetMouse()
local Character = player.Character
local Tool = Character:WaitForChild("Pokeball")
local ToolHandle = Tool:WaitForChild("Handle")
local PokeballO = RS.Pokeball
local Pokeball = PokeballO:Clone()
Pokeball.Parent = game.Workspace.PokeballClones
Pokeball.Position = Vector3.new(MousePosition)
Pokeball.Anchored = false
Pokeball.CanCollide = true
end)
bily117#5405 is my discord if u need to contact me

1 comment
Please use :Connect() insteas of :connect()