Hello!
I am currently making a system to detect when I player clicks F while having there mouse on a wall, it is finding the correct target in one line, then as soon as it fires it, it thinks the mouse.Target is the player
Here is my code:
--LOCAL SCRIPT
if mouse.Target then
if mouse.Target:FindFirstChild("Reinforcable") then
local wall = mouse.Target
print(wall)
if wall.Reinforcable.Value == true then
pickupEvent:FireServer(wall)
print("fired")
else
warn("ayo thats not allowed")
end
end
end
–SERVER SCRIPT
local pickupEvent = game.ReplicatedStorage:WaitForChild("Reinforce")
local maxDistance = 10
pickupEvent.OnServerEvent:Connect(function(target)
print("reinforce wall")
print(target)
if target.Reinforcable.Value == true then
print("true")
else
print("false")
end
print("finished")
end)