Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

RemoteEvent not working correctly?

Asked by
NotSoNorm 777 Moderation Voter
9 years ago

Idk whats wrong???

thx to LordDragonZord for the help so far

Local script

local Player = game.Players.LocalPlayer

Mouse.Button1Down:connect(function()
    local name = Player.Name
    game.Workspace.BlockInserter.BlockInsertation:FireServer(name)
end)

Server script

NormalParts = {["Slab"] = true,["Wall"] = true,["Plate"] = true}

script.BlockInsertation.OnServerEvent = function(game:GetService("Players"):WaitForChild([PLAYER_NAME NEEDED HERE]),name)   
local chil = game.Workspace[name]:GetChildren()
    for i, v in pairs (chil) do
        if NormalParts[v.Name] then
            local clone = workspace:FindFirstChild(name).Slab:Clone() or workspace:FindFirstChild(name).Wall:Clone() or workspace:FindFirstChild(name).Plate:Clone()
            clone.Parent = game.Workspace
        else
--          game.Players.player.PlayerGui.MoneyDisplay.ErrorDisplay.Description.Text = "Undefined part value: "..i.."
--          game.Players.player.PlayerGui.MoneyDisplay.ErrorDisplay:TweenPosition(UDim2.new(0.8, 0,0.9, 0),"InOut","Elastic",2.6,false)
--          wait(15)
--          game.Players.player.PlayerGui.MoneyDisplay.ErrorDisplay:TweenPosition(UDim2.new(-1, 0,0.9, 0),"InOut","Elastic",2.6,false)
        end
    end
end

Answer this question