Hello!
So Im working on this simple FPS game to learn more about development and ive come into an issue.
This is my server script that handles shooting bullets coming from the client
Events.Shoot.OnServerEvent:Connect(function(plr,part,pos,damage)
if part.Parent:FindFirstChild("Humanoid") then
local humanoid = part.Parent.Humanoid
if humanoid.Health > 0 then -- if enemy is alive
humanoid:TakeDamage(damage)
end
print(pos)
if part.Name == "Head" then
Events.DIDNumbers:FireClient(plr,
pos,
damage,
"-1"
)
Part is what the bullet hits, pos is the position the bullet lands, and damage is how much damage the gun bullet should do.
As you can see if I get a headshot it sends over the pos var.
In the local script that receives it. There is some more code that should not matter, the main thing is a print out CF which is the pos var that I sent in the server script.
function CreateIndicator(CF,number,numericType)
print(CF)
-- Clamp Position
local indicatorX , indicatorY = ClampPosition(CF)
end
Events.DIDNumbers.OnClientEvent:Connect(CreateIndicator())
For some reason, printing CF comes out as nil! Is this a roblox issue or am i messing something up. Im sorta new to scripting btw. Let me know if you need any more information
Thanks,
- Alex