--LocalScript
local player
local weapon = script.Parent
local mForRest
local bullet = weapon.hitter
local Var = weapon.Target
function shoot()
local target = mForRest.Hit
print(target)
Var.Value = target
end
weapon.Equipped:connect(function(mouse)
player = game:GetService("Players").LocalPlayer
mForRest = mouse
mouse.Button1Down:connect(shoot)
end)
-- Script
local target = script.Parent.Target
local bullet = script.Parent.hitter
target.Changed:connect(function(value)
print("ShotsFired")
local shot = bullet:Clone()
shot.Parent = workspace
shot.CFrame = value
shot.Size = Vector3.new(0.2,0.2,0.2)
end)
Both scripts are located within the tool. Hitter is an instance of a part and Target is a CFrame variable to communicate between the scripts.
Anyone know why this only works in single player?
Error log
hitter is not a valid member of Tool

4 comments
It Worked! :D Thanks :)
New on the site, how to accept an answer
You should see something like this, https://gyazo.com/4396906f650430c6562874073042e53c
If you don't, log out and in again. If you still don't see it, report the bug to the feedback to the left.