The error I’m getting:
20:53:04.310 - magnitude is not a valid member of Part
My ServerScript (In a part, located in workspace, in a Fire model):
script.Parent.Touched:Connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if game.Players:GetPlayerFromCharacter(hit.Parent) then
print(player.Name)
local purpose = "Fire"
game.ReplicatedStorage.GUIs.ShowInteraction:FireClient(player, purpose, script.Parent)
print("success")
end
end)
And finally my LocalScript (In a GUI, in PlayerGui):
game.ReplicatedStorage.GUIs.ShowInteraction.OnClientEvent:Connect(function(purposeOfInteraction, partFired)
print("received event")
if purposeOfInteraction == "Fire" then
if game.Players.LocalPlayer.Character.HumanoidRootPart.magnitude - partFired.Parent.FirePart.magnitude <= 3 then
script.Parent.Visible = true
else
script.Parent.Visible = false
end
end
local UIS = game:GetService("UserInputService")
local IKey = Enum.KeyCode.I
local function IisDown()
return UIS:IsKeyDown(IKey)
end
local function IisDownCont(input, gameProcessedEvent)
if IisDown() then
if purposeOfInteraction == "Fire" then
if game.Players.LocalPlayer.Character.HumanoidRootPart.magnitude - partFired.Parent.PrimaryPart.magnitude <= 3 then
while true do
wait(3)
game.Players.LocalPlayer.Statistics.Warmth.Value = game.Players.LocalPlayer.Statistics.Warmth.Value + 10
end
else
script.Parent.Visible = false
end
end
end
end
UIS.InputBegan:connect(IisDownCont)
end)
Thanks for the help, and if anything needs clarification, I’m all ears.