I’m trying to get the serverscript to print which ore I’m touching, but instead of doing this, it decides to randomly print elements of my avatar for some odd reason. I’m unsure how to solve this, as I believe it should run but it doesn’t run as intended.
Localscript
local Rock = game.Workspace.Rock
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local Hitbox = script.Parent:WaitForChild("Hitbox")
local replicatedStorage = game:GetService("ReplicatedStorage")
local OreTouchedEvent = replicatedStorage.OreTouchedEvent
Hitbox.Touched:Connect(function(player)
OreTouchedEvent:FireServer(player, Rock)
end)
Serverscript
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local OreTouchedEvent = ReplicatedStorage.OreTouchedEvent
OreTouchedEvent.OnServerEvent:Connect(function(player, Ore)
print(Ore)
end)
Hitbox.Touched:Connect(function(hit)
if not Player.Character then return end
if hit:IsDescendantOf(Player.Character) then return end
OreTouchedEvent:FireServer(Rock)
end)