So i have a local script which grabs mouse.hit.p, and a server script which grabs the mouse.hit.p using fire client, and uses the mouse position to move a part to where the mouse is. I am getting an error called " Posistion is not a valid member of Part?", when the script is activated the pillar appears in the game, but not where the mouse is.

Local Script

local tool = script.Parent
local RemoteFunction = tool:WaitForChild('PositionEvent')
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()

function RemoteFunction.OnClientInvoke(Argument)
   if Argument == "MousePosition" then
        return mouse.Hit.p
    end
end

Server Script

local Tool = script.Parent
local Teams = game:GetService("Teams")
local RemoteFunction = Tool:WaitForChild('PositionEvent')
local Cooldown = false
local CDTime = 45 
local CanMove = false 
Tool.RemoteEvent.OnServerEvent:Connect(function(Player)
local MousePos = RemoteFunction:FireClient(Player,'MousePosition')
print(MousePos)
	if Cooldown then return end
	
	spawn(function()
		Cooldown = true 
		wait(CDTime)
		Cooldown = false 
	end)
--local anim = Player.Character.Humanoid:LoadAnimation(Tool.eee) ANIMATIONS INACTIVE
--anim:Play()
Tool.heal:Play()
for i = 1,1 do
wait(.08)
local Pillar1 = game.ReplicatedStorage.pillar:Clone()
local effect = game.ReplicatedStorage.pillar.FireParticle
local steam = game.ReplicatedStorage.steam 
Pillar1.Parent = workspace
Pillar1.Anchored = true 
Pillar1.CanCollide = false 
Pillar1.Touched:Connect(function(hit)
	if hit and hit.Parent:FindFirstChild("Humanoid") then 
		local plr = workspace[hit.Parent.Name]
		local enemy = game.Players:GetPlayerFromCharacter(plr)
		if hit.Parent == Player.Character then return end
		if enemy.Team == "Attack" then return end 
		hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health + 30 
		local heale = effect:Clone()
		heale.Parent = hit.Parent.HumanoidRootPart
		Pillar1:Destroy()
		wait(1)
		heale:Destroy()
	end
end)

Pillar1.Posistion = MousePos
game.Debris:AddItem(Pillar1,4)
local cd = steam:Clone()
cd.Parent = Player.Character['Right Arm']
end
end)

6 comments

0

You spelled it wrong. It's "Position", not "Posistion"

0

ok, really dumb mistake on my part, I changed that but now i'm getting the error "bad argument #3 to 'Position' (Vector3 expected, got nil)"

1

i have never seen function RemoteFunction.OnClientInvoke(Argument) and now i am enlightened

0

Is that a typo?

0

That's my name @Fifkee xd

0

So the solution if anyone else has this problem is to use a different local script and a different way of giving mouse.hit to the sever script. I just used a tool.activated and mouse.hit function.