Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

A spinner script that is meant to give things isn't working... What did i do wrong?

so i'm making a spinner that will give a random folder with scripts to the player (from replicated storage to inside the player's backpack) and the first script isnt working... what do i do?

first script:



script.Parent.MouseButton1Click:Connect(function()
	
	local folder = game.ReplicatedStorage.Quirks
	
	 local quirkname = script.Parent.Parent.Result.Text
	
	if quirkname == " " then print(" ") 
	script.Parent.Parent.Parent.QuirkSpin.Visible = false
    wait(0.1)
		
	elseif quirkname == "One For All" then print("ofa")
	local clone1 = folder["One For All"]:Clone()
	
	clone1.Parent = script.Parent.Parent.Parent.Parent.Parent.Backpack
	script.Parent.Parent.Parent.QuirkSpin.Visible = false
    wait(0.1)

elseif  quirkname == "Explosion" then print("boom")
	local clone2 = folder.Explosion:Clone()
	
	clone2.Parent = script.Parent.Parent.Parent.Parent.Parent.Backpack
	script.Parent.Parent.Parent.QuirkSpin.Visible = false
    wait(0.1)

elseif quirkname == "HHHC" then print("HHHC")
	local clone3 = folder.HHHC:Clone()
	
	clone3.Parent = script.Parent.Parent.Parent.Parent.Parent.Backpack
	script.Parent.Parent.Parent.QuirkSpin.Visible = false
    wait(0.1)

	end
	end)

and the other script inside another button is:

script.Parent.Parent.finish.script.Disabled = true
script.Parent.Parent.Parent.Quirk.TextButton.LocalScript.Disabled = false

local list = { "One For All",  "Explosion", "HHHC" } 

script.Parent.Parent.title.Text = "Spin For A Quirk"
local enabled = true



script.Parent.MouseButton1Click:Connect(function(player)
	if enabled== false then return end
	
	script.Parent.Parent.finish.script.Disabled = true
	script.Parent.Parent.Parent.Quirk.TextButton.LocalScript.Disabled = true
    enabled= false
	local t = 0.025
	
	for i = 1, 75 do
		script.Parent.Parent.Result.Text = list[math.random(1, #list)]
		
		if i == 50 then t = 0.05 end
		if i == 55 then t = 0.1 end
		if i == 70 then t = 0.5 end
		if i == 75 then 	
			script.Parent.Parent.title.Text = "Your Quirk is..."
			enabled= true
			
			script.Parent.Parent.finish.script.Disabled = false
			script.Parent.Parent.Parent.Quirk.TextButton.LocalScript.Disabled = false
			
		end
		wait(t)
		print("waiting t")
	end
	
end)

please help!

both scripts are inside buttons in a screen gui's frame

(p.s. I'm kinda new to scripting, so if i made any other mistakes, please tell me how to fix...)

1 comment

0

i dont know

1 answer

✓ Accepted answer

Regular scripts cannot detect MouseButton clicks so i recommend u use a combo of scripts, A example i will show u in this script, Take Spinned as a remote event in ur textbutton Local Script:

script.Parent.MouseButton1Click:Connect(function()
local player = game.Players.LocalPlayer
script.parent.Spinned:FireServer(player)
end)

Reg Script:

script.parent.Spinned.OnServerEvent:Connect(function(Useless,player)
local folder = game.ReplicatedStorage.Quirks

     local quirkname = script.Parent.Parent.Result.Text

    if quirkname == " " then print(" ") 
    script.Parent.Parent.Parent.QuirkSpin.Visible = false
    wait(0.1)

    elseif quirkname == "One For All" then print("ofa")
    local clone1 = folder["One For All"]:Clone()

    clone1.Parent = player:WaitForChild("BackPack")
local clone2 = folder["One For All"]:Clone()
clone2.Parent = player:WaitForChild("StarterGear")
    script.Parent.Parent.Parent.QuirkSpin.Visible = false
    wait(0.1)

elseif  quirkname == "Explosion" then print("boom")
    local clone2 = folder.Explosion:Clone()

    clone2.Parent = player:WaitForChild("BackPack")
local clone3 = folder.Explosion:Clone()
clone3.Parent = player:WaitForChild("StarterGear")
    script.Parent.Parent.Parent.QuirkSpin.Visible = false
    wait(0.1)

elseif quirkname == "HHHC" then print("HHHC")
    local clone3 = folder.HHHC:Clone()

    clone3.Parent = player:WaitForChild("BackPack")
local clone2 = folder.HHHC:Clone()
clone2.Parent = player:WaitForChild("StarterGear")
    script.Parent.Parent.Parent.QuirkSpin.Visible = false
    wait(0.1)
end
    end)

This should help u with that problem, But the other script i honestly dont know

1 comment

0

Doesn't work, but thats okay since i switched over from using a gui to a part that randomly gives one of the folders to the player and it works fine. Thanks anyway, and sorry to waste your time.

This discussion is preserved as it was. New answers, comments, and votes are closed.