Hello, so I have a script which is suppose to shoot a red ball of ketchup on left click, and the player it hits will be shown the splatter gui. Heres the code:
p = game.Players.LocalPlayer
mouse = p:GetMouse()
piws = workspace:WaitForChild(p.Name)
ws = piws.Humanoid.WalkSpeed
fov = workspace.Camera.FieldOfView
local function isInPlayer(part)
local player = game.Players:GetPlayerFromCharacter(part)
if player then
return player
elseif part.Parent ~= workspace then
return isInPlayer(part.Parent)
else
return nil
end
end
script.Parent.Equipped:connect(function(mouse)
mouse.Button1Up:connect(b1up)
mouse.Button2Down:connect(b2down)
mouse.Button2Up:connect(b2up)
end)
function Touched(part)
if isInPlayer(part) then
repeat
wait()
until isInPlayer(part):FindFirstChild("PlayerGui")
if not isInPlayer(part).PlayerGui.popups:FindFirstChild("ksplatter") then
isInPlayer(part).leaderstats.Splats.Value = isInPlayer(part).leaderstats.Splats.Value + 1
game.ReplicatedStorage.ksplatter:Clone().Parent = isInPlayer(part).PlayerGui.popups
end
end
end
function b1up()
local ketchup = game.ReplicatedStorage.ketchupblob:Clone()
ketchup.Parent = workspace
ketchup.Position = Vector3.new(piws.Head.Position.x, piws.Head.Position.y + 2, piws.Head.Position.z)
local bf = Instance.new("BodyForce")
bf.Parent = ketchup
bf.Force = Vector3.new(0, ketchup:GetMass() * workspace.Gravity * 0.8, 0)
ketchup.Velocity = (mouse.hit.p - ketchup.Position).unit * 200
ketchup.Touched:connect(Touched)
end
function b2down()
fov = workspace.Camera.FieldOfView
ws = piws.Humanoid.WalkSpeed
piws.Humanoid.WalkSpeed = 5
p.CameraMode = Enum.CameraMode.LockFirstPerson
workspace.Camera.FieldOfView = 20
mouse.Icon = "http://www.roblox.com/asset/?id=123566253"
end
function b2up()
workspace.Camera.FieldOfView = fov
piws.Humanoid.WalkSpeed = ws
p.CameraMode = Enum.CameraMode.Classic
mouse.Icon = "http://www.roblox.com/asset/?id=440124541"
end
script.Parent.Unequipped:connect(function()
workspace.Camera.FieldOfView = fov
piws.Humanoid.WalkSpeed = ws
p.CameraMode = Enum.CameraMode.Classic
mouse.Icon = "http://www.roblox.com/asset/?id=440124541"
end)
Sadly, the person shooting it is splattered, and the ball just goes right through the other player without it affecting them? All help is appreciated. :)

2 comments
So should use like a remote function, or what?
Try the edit I just made.