Currently, I am scripting this system in which you have a tool that allows you to choose the denomination of the euro you wish to place down/give to someone. It does this by getting the player’s mouse hit location and then a remote event that triggers a function. The function is what I am having an issue with.
The script will only run to the “Copy.Parent = game.Workspace” when I have the €1 denomination selected and gives me the errormessage:
parent is not valid member of UnionOperation “Euronote”
I have done roughly an hours worth of research on this and asking around it either doesn’t apply to this script at least in a way in which I can translate it. The people I ask know nothing about it what so ever.
Local Script
local equipped = false
local mouse = game.Players.LocalPlayer:GetMouse()
local player = game.Players.LocalPlayer
game.Players.LocalPlayer.PlayerGui:FindFirstChild("WalletToolUi")
print("player")
local DenominationList = {
[1] = 1,
[2] = 2,
[3] = 5,
[4] = 10,
[5] = 20,
[6] = 50
}
local Denomination = 1
local function getAmount()
return DenominationList[Denomination]
end
print(Denomination)
local function WalletGUI()
if equipped == true then
game.Players.LocalPlayer.PlayerGui.WalletToolUi.Frame.Visible = true
game.Players.LocalPlayer.PlayerGui.WalletToolUi.Frame.Denom.Text = "€"..getAmount()
else
game.Players.LocalPlayer.PlayerGui.WalletToolUi.Frame.Visible = false
end
end
script.Parent.Equipped:connect(function() equipped = true WalletGUI() print("equipped ") end)
script.Parent.Unequipped:connect(function() equipped = false WalletGUI() print("unequipped") end)
game:GetService("UserInputService").InputBegan:connect(function(input,gameProcessed)
if equipped and gameProcessed == false and input.UserInputType == Enum.UserInputType.Keyboard then
if input.KeyCode == Enum.KeyCode.E then
if DenominationList[Denomination + 1] then
Denomination = Denomination + 1
end
WalletGUI()
elseif input.KeyCode == Enum.KeyCode.Q then
if DenominationList[Denomination - 1] then
Denomination = Denomination - 1
end
WalletGUI()
end
end
end)
mouse.Button1Down:connect(function()
if equipped and game.Players.LocalPlayer.Character and game.Players.LocalPlayer.Character:FindFirstChild("Head") then
local distance = (game.Players.LocalPlayer.Character.Head.Position - mouse.Hit.p).magnitude
if distance < 15 then
game.ReplicatedStorage.RemoteEvents.DropMoney:FireServer(mouse.Hit, getAmount())
print("fired1")
end
end
end)
Server Script
local module = {}
local function spawnEuroNote(player, cframe, Denomination)
print(Denomination)
for i, v in pairs(game.ReplicatedStorage.EuroFolder.Euronote:GetDescendants()) do
if v.Name == "Denom" and v.Value == Denomination then
v = v.parent
print(v)
if v.Denom.Value == Denomination and player.leaderstats.euro.Value >= Denomination then
print("ValuesCorrect")
local copy = v:clone()
copy.parent = game.Workspace
copy.CFrame = cframe
player.leaderstats.euro.Value = player.leaderstats.euro.Value - Denomination
end
end
end
end
game.ReplicatedStorage.RemoteEvents.DropMoney.OnServerEvent:connect(function(player, cframe, Denomination)
print("fired")
spawnEuroNote(player, cframe, Denomination)
end)
return module
I would appreciate any help at all, Thank you.