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

This works in the testing server but not in the actual game? Its in localScript! Why????

Asked by 8 years ago
local player = game.Players.LocalPlayer
local currency = player:WaitForChild('leaderstats').Points
local amount = 50
local tool = game.ServerStorage:WaitForChild('BlueKatana')
local indextext = script.Parent.Text
script.Parent.MouseButton1Click:connect(function()
    if currency.Value >= amount and not player.Backpack:FindFirstChild('BlueKatana') or player.Character:FindFirstChild('BlueKatana') then
        currency.Value = currency.Value - amount
        local newtool = tool:Clone()
        newtool.Parent = player.Backpack
    else 
        script.Parent.Text = 'Purchase failed!'
        wait(0.7)
        script.Parent.Text = indextext
    end
end)

script.Parent.MouseEnter:connect(function()
    script.Parent.Parent.Parent.ProductImage.Image = 'rbxassetid://'..script.ImageValue.Value
    script.Parent.Parent.Parent.Description.Text = script.DescValue.Value
    script.Parent.Parent.Parent.ProductTitle.Text = script.TitleValue.Value
end)
script.Parent.MouseLeave:connect(function()
    script.Parent.Parent.Parent.ProductImage.Image = 'rbxassetid://'
    script.Parent.Parent.Parent.Description.Text = ''
    script.Parent.Parent.Parent.ProductTitle.Text = ''
end)
0
Strange willkiller13 43 — 8y
0
Try using a code block please it will make more sense. KingLoneCat 2642 — 8y
0
Ohh sure ok willkiller13 43 — 8y
0
There you go! willkiller13 43 — 8y
View all comments (12 more)
0
This is weird because I reloaded the page and now it shows a script that I saw not too long ago on here from a different person is that ur script with the moves of the Pokemon? KingLoneCat 2642 — 8y
0
Never mind this website is acting weird on this iPad... KingLoneCat 2642 — 8y
0
Ok... xD willkiller13 43 — 8y
0
Do you know how to access the dev controller inside of a game? As in if you know how to check the output in game I do but I am asking you because try checking the output and tell me what error it pops up in there... KingLoneCat 2642 — 8y
0
Where is the script placed? iNicklas 215 — 8y
0
The script is placed inside of a text button of a gui - localscript willkiller13 43 — 8y
0
Did it pop any errors inside of the game? In the output... KingLoneCat 2642 — 8y
0
How do you check for errors? I got the output but it says random stuff willkiller13 43 — 8y
0
Well does the output pop up any errors it should pop up an error in the output just tell me what this 'random stuff' is. KingLoneCat 2642 — 8y
0
17:50:16.018 - Content failed because HTTP 400 (HTTP/1.1 400 Input string was not in a correct format.) 17:50:16.026 - Unable to load plugin icon. 17:50:16.146 - Unable to create an Instance of type "StockSound" 17:50:16.147 - Script 'Plugin_-1.CutsceneEdit.Plugin', Line 58 - global addSound 17:50:16.147 - Script 'Plugin_-1.CutsceneEdit.Plugin', Line 65 17:50:16.147 - Stack End 17:50:31.321 - Work willkiller13 43 — 8y
0
Accept the below answer by clicking "Accept Answer" under eLunate's name/picture. SynphonyKnight 85 — 8y
0
Done. willkiller13 43 — 8y

1 answer

Log in to vote
5
Answered by 8 years ago

LocalScripts can't access ServerStorage

Your script yields indefinitely at

local tool = game.ServerStorage:WaitForChild('BlueKatana')

The solution is to either move all logic concerning this tool to the server, or to move the tool to ReplicatedStorage.

0
That makes more sence,Thanks! willkiller13 43 — 8y
Ad

Answer this question