I’m encountering a issue with a RemoteEvent setup in my game. The goal is to trigger an event when interacting with a prompt on a block object. The server script fires the event correctly, but I consistently receive an “Invalid character structure” error. Despite verifying the hierarchy, checking parenting, and adding delays, the issue persists. The blockPart
and the player’s character model are both located in Workspace
, and the script appears to execute properly. I suspect there might be an intricacy I’m missing. Any insights or suggestions on how to resolve this would be greatly appreciated!
Here is the code:
local interactivePrompt = script.Parent
local blockPart = interactivePrompt.Parent
local replicatedStorage = game:GetService("ReplicatedStorage")
local equipBlockEvent = Instance.new("RemoteEvent")
equipBlockEvent.Name = "equipBlock"
equipBlockEvent.Parent = replicatedStorage
local function toggleEquip(player)
print("Toggle Equip fired for player:", player.Name)
equipBlockEvent:FireClient(player)
end
interactivePrompt.Triggered:Connect(function()
print("Triggered event fired on the server.")
wait(1)
local character = blockPart.Parent:FindFirstChild("HumanoidRootPart")
if character then
local player = game.Players:GetPlayerFromCharacter(character.Parent)
if player then
print("Player found:", player.Name)
toggleEquip(player)
else
print("No player found.")
end
else
print("Invalid character structure.")
end
end)